Brian Warehouse

Some birds aren`t meant to be caged, their feathers are just too bright... ...
posts - 40, comments - 16, trackbacks - 0, articles - 1

POJ 1006 Biorhythms

Posted on 2010-08-17 14:10 Brian 阅读(130) 评论(0)  编辑 收藏 引用 所属分类: POJ
典型的阅读理解题 , 读懂意思基本上思路就出来了,恰巧又是一道中文题,这里用枚举,其他不解释。

POJ 1006 Biorhythms - Icho - Brian Warehouse#include <stdio.h>
POJ 1006 Biorhythms - Icho - Brian Warehouse
int main()
POJ 1006 Biorhythms - Icho - Brian WarehousePOJ 1006 Biorhythms - Icho - Brian Warehouse
POJ 1006 Biorhythms - Icho - Brian Warehouse{
POJ 1006 Biorhythms - Icho - Brian Warehouse    
int i,a,b,c,d,days=0;
POJ 1006 Biorhythms - Icho - Brian Warehouse    
while(1)
POJ 1006 Biorhythms - Icho - Brian WarehousePOJ 1006 Biorhythms - Icho - Brian Warehouse    
POJ 1006 Biorhythms - Icho - Brian Warehouse{
POJ 1006 Biorhythms - Icho - Brian Warehouse        days
++;
POJ 1006 Biorhythms - Icho - Brian Warehouse        scanf(
"%d%d%d%d",&a,&b,&c,&d);
POJ 1006 Biorhythms - Icho - Brian Warehouse        
if (a+b+c+== -4break;
POJ 1006 Biorhythms - Icho - Brian Warehouse        
for (i=d+1; ; i++// pay attention: from d+1
POJ 1006 Biorhythms - Icho - Brian WarehousePOJ 1006 Biorhythms - Icho - Brian Warehouse
        POJ 1006 Biorhythms - Icho - Brian Warehouse{
POJ 1006 Biorhythms - Icho - Brian Warehouse            
if ((i-a)%23==0)
POJ 1006 Biorhythms - Icho - Brian Warehouse                
if ((i-b)%28==0)
POJ 1006 Biorhythms - Icho - Brian Warehouse                    
if ((i-c)%33==0)
POJ 1006 Biorhythms - Icho - Brian WarehousePOJ 1006 Biorhythms - Icho - Brian Warehouse                    
POJ 1006 Biorhythms - Icho - Brian Warehouse{
POJ 1006 Biorhythms - Icho - Brian Warehouse                        printf(
"Case %d: the next triple peak occurs in %ld days.\n",days,i-d);
POJ 1006 Biorhythms - Icho - Brian Warehouse                        
break;
POJ 1006 Biorhythms - Icho - Brian Warehouse                    }

POJ 1006 Biorhythms - Icho - Brian Warehouse        }

POJ 1006 Biorhythms - Icho - Brian Warehouse    }

POJ 1006 Biorhythms - Icho - Brian Warehouse    
return 0;
POJ 1006 Biorhythms - Icho - Brian Warehouse}

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理