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;
}
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;
}
相关文章推荐
- MOD Problem Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 191(64 users) Total Accepted: 69(53 users) Special Judge: No Description Give yo
- Simple Line Editor Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 250(49 users) Total Accepted: 74(42 users) Special Judge: No Description
- 菜鸟和大牛 Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 114(48 users) Total Accepted: 51(45 users) Special Judge: No Description blue和AutoGerk
- MOD Problem Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 191(64 users) Total Accepted: 69(53 users) Special Judge: No Description Give yo
- 75.Your test database is configured to run in NOARCHIVELOG mode. One of the data files in the USERS
- Your build host version of Xamarin.IOS (release NO.)is too recent to work with the IOS designer
- 三好学生 Time Limit: 5000 MS Memory Limit: 65536 K Total Submit: 242(80 users) Total Accepted: 94(70 users) Special Judge: No Description 一个班级有N个学生,M门课,
- You're given a string of lower-case Latin letters. Your task is to find the length of its longest su
- 病毒 Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 322(54 users) Total Accepted: 87(45 users) Special Judge: No Description 某种病毒袭击了某地区,该地区有N
- Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "te
- 72.You want to enable archiving on your database. Presently, the database is running in NOARCHIVELOG
- tesseract-ocr 出现 错误 Please make sure the TESSDATA_PREFIX environment variable is set to the parent d irectory of your "tessdata" directory.解决方案
- springboot的启动Your ApplicationContext is unlikely to start due to a @ComponentScan of the default pac
- Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "te
- Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
- Timeout expired. The timeout period elapsed prior to completion of the operation or the server is no
- 4.Your test database is running in NOARCHIVELOG mode. Which statement is true regarding the type of
- Your ApplicationContext is unlikely to start due to a @ComponentScan of the default
- Your project is not referencing the ".NETPortable,Version=v4.5,Profile=Profile259" framework. Add a reference to ".NETPortable,Version=v4.5,Profile=Profile259" in the "frameworks" section of your proj