| ||||||||||
| 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>
#include<math.h>
long int p[5000];
long int e[5000];
long int i[5000];
long int d[5000];
main()
{
int j=0;
int total;
int count;
while(1)
{
scanf("%ld %ld %ld %ld",&p[j],&e[j],&i[j],&d[j]);
if((p[j] == -1) && (e[j] == -1) && (i[j] == -1) && (d[j] == -1))
break;
j++;
}
total = j;
for(j=0;j<total;j++)
{
while(p[j] > d[j])
p[j] -= 23;
while(e[j] > d[j])
e[j] -= 28;
while(i[j] > d[j])
i[j] -= 33;
count = 1;
while(1)
{
if(((abs(i[j] + 33.0 * count - p[j]) / 23.0) - (int)(abs(i[j] + 33.0 * count - p[j]) / 23.0) < 1e-4)
&& ((abs(i[j] + 33.0 * count - p[j]) / 23.0) - (int)(abs(i[j] + 33.0 * count - p[j]) / 23.0) < 1e-4) > -1e-4)
{
if(((abs(i[j] + 33.0 * count - e[j]) / 28.0) - (int)(abs(i[j] + 33.0 * count - e[j]) / 28.0) < 1e-4)
&& ((abs(i[j] + 33.0 * count - e[j]) / 28.0) - (int)(abs(i[j] + 33.0 * count - e[j]) / 28.0) < 1e-4) > -1e-4)
break;
}
count++;
}
printf("Case %d: the next triple peak occurs in %ld days.\n",j+1,i[j] + 33 * count - d[j]);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator