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:帮忙看一看那里错了。谢谢!In Reply To:Re:帮忙看一看那里错了。谢谢! Posted by:qiang at 2003-09-06 14:18:13 > #include<stdio.h> > > int main() > { > int p, e, i, d; > int j, days, x; > > scanf( "%d%d%d%d", &p, &e, &i, &d ); > j = 0; > while( p != -1 || e != -1 || i != -1 || d != -1 ) > { > j++; > for( x = i; ; x += 33 ) > { > if(x >d && x >= p && x >= e && x >= i && (x-p)%23 == 0 && (x-e)%28 == 0 && (x-i)%33 == 0 ) > { > days = x % 21252 ; > break; > } > } > days -= d; > if(days<=0) days +=21252; > /* if( x > 21252 ) > days = 21252-d; */ > printf( "Case %d: the next triple peak occurs in %d days.\n", j, days ); > scanf( "%d%d%d%d", &p, &e, &i, &d ); > } > } > 改成这样可以ac,但运行时间要很长,最好直接找出规律 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator