ACM 1006--生理周期

来源:互联网 发布:apache 不允许ip访问 编辑:程序博客网 时间:2024/06/10 02:57
#include <stdio.h>
int main()
{
    int p[200],e[200],i[200],d[200],j=0,k,result[200];
    scanf("%d%d%d%d",&p[j],&e[j],&i[j],&d[j]);
    while(p[j]!=-1||e[j]!=-1||i[j]!=-1)
         {
             j++;
             scanf("%d%d%d%d",&p[j],&e[j],&i[j],&d[j]);
         }
   
       for(k=0;k<j;k++)
           {
             
                int m=0;
                 result[k]=(5544*p[k]+14421*e[k]+1288*i[k]-d[k]+21252)%21252;
                 if(result[k]==0)
                       result[k]=21252;
           }
                              
                 for(k=0;k<j;k++)
                         printf("Case %d: the next triple peak occurs in %d days./n",(k+1),result[k]);
              return 0;
}             
 
原创粉丝点击