1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; if(a==2){ cout<<1<<endl; } else if(a==3){ cout<<3<<endl; } else if(a==4){ cout<<6<<endl; } else if(a==5){ cout<<10<<endl; } else if(a==6){ cout<<15<<endl; } else if(a==7){ cout<<21<<endl; } else if(a==8){ cout<<28<<endl; } else if(a==9){ cout<<36<<endl; } else if(a==10){ cout<<45<<endl; } return 0; }
Python :
n = int(input()) t = 0 for i in range(1, n): t += i print(t)
- 1
Information
- ID
- 10641
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By