首页 > 其他 > 详细

poj 1006

时间:2015-03-08 20:04:10      阅读:278      评论:0      收藏:0      [点我收藏+]

无情的选择了一道看似简单的题

结果被教育

#include <stdio.h>
int main()
{
	int p, e, i, d, j = 1, day;
	while ((scanf("%d %d %d %d", &p, &e, &i, &d)) && (p + e + i + d) != -4)
	{
		day = (5544 * p + 14421 * e + 1288 * i - d + 21252) % 21252;
		if (day == 0)
		{
			day = 21252;
		}
		printf("Case %d: the next triple peak occurs in %d days.\n", j++, day);
	}
}






//WC
/*#include <stdio.h>
int main(){
	int a, b, c, d,i,j=1;
	while ((scanf("%d %d %d %d", &a, &b, &c, &d))&&(a+b+c+d)!=-4){
		for (i = 21252; i > 0; i--)
			if ((i - a) % 23 == 0 && (i - b) % 28 == 0 && (i - c) % 33 == 0)
				if (i-d)
					printf("Case %d: the next triple peak occurs in %d days.\n", j++,i-d);
				else
					printf("Case %d: the next triple peak occurs in %d days.\n", j++, i - d+21252);
	}	
	return 0;
	}	*/

  

poj 1006

原文:http://www.cnblogs.com/R7-s/p/4322122.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!