Submission
# | When | Author | Problem | Language | CPU | Memory | |
---|---|---|---|---|---|---|---|
4466 | 2022-03-25 19:56:03 | The_crawler | Sum Game II | C++ 17 | 2 ms | 3444 kb | Accepted |
Source Code
/* Author: Tazim(The_crawler) */ #include<bits/stdc++.h> #define ll long long int #define dec greater<int>() #define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower); #define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper); #define prow(n) for(auto i:n)cout<<i<<" ";cout<<endl; #define pcol(n) for(auto i:n)cout<<i<<endl; #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; #define debug(x) cout<<#x<<" = ";_print(x); cout<<endl; /// Debug function using namespace std; ///**** bool sortbysec(const pair<int, int>& a, const pair<int, int>& b) { return (a.second < b.second); } template<class T> void _print(T x) { cout << x; } template<class T> void _print(vector<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } template<class T> void _print(set<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } template<class T, class V> void _print(pair<T, V>x) { cout << "{" << x.first << "," << x.second << "} "; } template<class T, class V> void _print(map<T, V>x) { cout << "[ ";for (auto i : x)_print(i);cout << "]"; } template<class T> void _print(multiset<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } /* Hack my code. It's Easy to Read */ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // start int t; cin >> t; while (t--) { ll n; cin >> n; n--; cout << (n * (n + 1)) / 2 << endl; } return 0; }