| ||||||||||
| 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 | |||||||||
你ac的是989ms,时间上稍微误差一点就超时In Reply To:同样的程序 不一样的结果?WHY? Posted by:heiheigo at 2005-07-10 11:26:35 > Source
>
> Problem Id:1006 User Id:heiheigo
> Memory:28K Time:989MS
> Language:C Result:Accepted
>
> Source
>
> #include "stdio.h"
> int main(){
> int p,e,i,d;
> int j=1;
> int k=1;
> long r;
> while(scanf("%d%d%d%d",&p,&e,&i,&d)){
> if(p==-1)
> break;
> while(k){
> //r=p+(k-1)*23;
>
> if((k-p)%23==0&&(k-e)%28==0&&(k-i)%33==0){
> k=k-d;
> if(k<=0)
> k+=21252;
> break;
> }
> k++;
> }
> printf("Case %d: the next triple peak occurs in %ld days.\n", j, k);
> j++;
> k=1;
> }
> return 0;
> }
>
>
>
> Source
>
> Problem Id:1006 User Id:heiheigo
> Memory:28K Time:1004MS
> Language:C Result:Time Limit Exceed
>
> Source
>
> #include "stdio.h"
> int main(){
> int p,e,i,d;
> int j=1;
> int k=1;
> long r;
> while(scanf("%d%d%d%d",&p,&e,&i,&d)){
> if(p==-1)
> break;
> while(k){
> //r=p+(k-1)*23;
>
> if((k-p)%23==0&&(k-e)%28==0&&(k-i)%33==0){
> k=k-d;
> if(k<=0)
> k+=21252;
> break;
> }
> k++;
> }
> printf("Case %d: the next triple peak occurs in %ld days.\n", j, k);
> j++;
> k=1;
> }
> return 0;
> }
>
>
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator