|
|
back to boardDiscussion of Problem 1068. Sumwrong!!! Posted by _harun 25 Apr 2015 15:46 int main() { // ios_base::sync_with_stdio(false); int n,sum; while(cin>>n) { sum=0; if(n<0) for(int i=1; i>=n; i--) sum+=i; else sum=(n*(n+1))/2; cout<<sum<<endl; } return 0; } |
|
|