码迷,mamicode.com
首页 > 其他好文 > 详细

poj 1006

时间:2015-03-08 20:05:52      阅读:127      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!