poj1006_Biorhythms

  英语真差劲啊,看题目没看明白,无奈重新开始手抄题目,突然发现一句话 “For each cycle,you will be given the number of days form the beginning of the current year at which one of its peaks occurs. " 看到这句才反应过来应该把前三个值分别取余,好笨啊!

 1 #include <stdio.h>
 2 #include <math.h>
 3 int main(){
 4     int k,i,n,j;
 5     int a,b,c,d;
 6     int cnt=0;
 7     while(~scanf("%d%d%d%d",&a,&b,&c,&d)){
 8         if(a==-1&&b==-1&&c==-1&&d==-1)
 9             break;
10         a=a%23;b=b%28;c=c%33;
11         for(i=1;i<=1000000;++i){
12             if(i<a||i<b||i<c) continue;
13             if( ((i-a)%23==0) && ((i-b)%28==0) && ((i-c)%33==0) ){
14                 if(d>=i){
15                     printf("Case %d: the next triple peak occurs in %d days.\n",++cnt,i-d+23*28*33);
16                 }else 
17                     printf("Case %d: the next triple peak occurs in %d days.\n",++cnt,i-d);
18                 break;
19             }
20         }
21     }
22     return 0;
23 }

 

posted on 2014-01-02 18:36 symons 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/symons1992/p/3502354.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值