| ||||||||||
| 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 | |||||||||
请各位兄弟(姐妹)帮我看一下哪里出错了,万分感谢~~新手
#include <stdio.h>
int main()
{
int p,e,i,d,j,t=1,x;
while((scanf("%d%d%d%d",&p,&e,&i,&d))!=EOF)
{
if(p==-1 && e==-1 && i==-1 && d==-1)
break;
for(j=1;;j++)
if((j+p)%23==0 && (j+e)%28==0 && (j+i)%33==0)
break;
x=21252-j-d;
printf("Case %d: the next triple peak occurs in %d days.\n",t++,x);
}
return 0;
}
或者是(好像是一样的错误):
program mimi(input,output);
var
p,e,i,d,n,x,j:integer;
begin
j:=0;
while not eof do
begin
readln(p,e,i,d);
if((p=-1)and(e=-1)and(i=-1)and(d=-1)) then break
else
begin
j:=j+1;
for n:=0 to 21252 do
begin
if(((n+p)mod 23=0)and((n+e)mod 28=0)and((n+i)mod 33=0))
then break
end;
x:=21252-n-d;
writeln('Case ',j,': the next triple peak occurs in ',x,' days.')
end
end
end.
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator