| ||||||||||
| 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:ac了,但是有很多疑问,可以在你们的机器上帮我测下吗?In Reply To:ac了,但是有很多疑问,可以在你们的机器上帮我测下吗? Posted by:wcw at 2008-04-01 17:14:55 这是我原来的程序,麻烦些,但我觉得也应该可以通过阿,但也总是报wa,不知是不是跟前面类似问题?很奇怪?
#include <stdio.h>
#include <math.h>
int
main( ){
int n = 0;
int p, e, i, given;
int count = 1;
int result[1000];
float d, c;
while( 1 ){
scanf( "%d%d%d%d", &p, &e, &i, &given );
if( p == -1 ){
break;
}
while( 1 ){
result[n] = count * 23 + p;
d = ( float )( result[n] - e ) / 28;
c = ceil( d );
if ( c == d ){
d = ( float )( result[n] - i ) / 33;
c = ceil( d );
if ( c == d ){
result[n] -= given;
count = 1;
break;
}
}
count++;
}
n++;
}
for( i = 0; i < n; i++ ){
printf( "Case %d: the next triple peak occurs in %d days.\n", i + 1, result[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