|
|
вернуться в форумwhat is the problem?!! whats problem with the code below?Judge is giving wrong answer. #include<iostream.h> main() { long int n,sum; cin>>n; if(n<0) sum=1+n*(1-n)/2; else sum=n*(n+1)/2; cout<<sum; } Everyone who makes this problem can see that there are 3 cases, you just did 2 :) (-) Two is enough. Actually, it's possible to write one expression > |
|
|