您的位置:首页 > 其它

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 + ...

2012-08-28 21:56 645 查看
#include<stdio.h>
intmain()
{
longinti,n;
longints1,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);
}
return0;
}


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐