| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:暴搜的,竟然过了,数据要求也应该不严吧,读懂题就行了~(PS:不知道剩余定理,一会儿看看去)In Reply To:暴搜的,竟然过了,数据要求也应该不严吧,读懂题就行了~(PS:不知道剩余定理,一会儿看看去) Posted by:loganberry at 2011-01-22 18:00:54 嗯嗯,暴力无敌.偶也是暴过的.....
> //HDOJ 1370
> #include<stdio.h>
> int main()
> {
> int P,E,I,D;
> int i;
> int count=1;
> int temp;
> while(scanf("%d%d%d%d",&P,&E,&I,&D)!=EOF)
> {
> if(P==-1&&E==-1&&I==-1&&D==-1)
> break;
> if(P>=23)
> P=P%23;
> if(E>=28)
> E=E%28;
> if(I>=33)
> I=I%33;
> for(i=0;i<=21252;i++)
> {
> temp=i+D;
> if(temp%23==P&&temp%28==E&&temp%33==I&&temp!=D)
> break;
> }
> printf("Case %d: the next triple peak occurs in %d days.\n",count++,i);
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator