Total Submit: 352(98 users) Total Accepted: 122(84 users) Special Judge: No Description Your task now is to caculate the answer of (1 + 2 + 3 + ...
#include<stdio.h>
int main()
{
long int i,n;
long int s1,s2,s;
while(scanf("%ld",&n)!=EOF)
{
s1=0;s2=0;s=0;
if(n%2==0)
{s1=n/2%2011;s2=(n+1)%2011;}// (a+b)%c与(a%c+b%c)%c相等,乘时也一样,
else
{s1=(n+1)/2%2011;s2=n%2011;}
s=(s1*s2)%2011;
printf("%ld\n",s);
}
return 0;
}