POJ 1006
来源:互联网 发布:京东 省市区数据库 编辑:程序博客网 时间:2024/05/29 17:53
这道题难度在于数学通式的转换,如果不理解中国剩余定理,这道题做出来感觉也比较水,代码如下:
import java.util.Scanner;public class poj1006 {/** * @param args */public static void main(String[] args) {Scanner in = new Scanner(System.in);int loop = 1;while (true) {int p = in.nextInt();int e = in.nextInt();int i = in.nextInt();int d = in.nextInt();if (p == -1 && e == -1 && i == -1 && d == -1) {break;}int days = (5544 * p + 14421 * e + 1288 * i - d + 21252) % 21252;if (days <= 0) {System.out.println("Case " + loop+ ": the next triple peak occurs in " + (21252 - days)+ " days.");} else {System.out.println("Case " + loop+ ": the next triple peak occurs in " + days+ " days.");}loop++;}}}
0 0
- POJ[1006]
- POJ 1006
- poj 1006
- poj 1006
- poj 1006
- POJ 1006
- poj 1006
- poj 1006
- POJ-1006
- poj 1006
- POJ 1006
- poj 1006
- POJ 1006
- POJ-1006
- POJ 1006
- POJ 1006
- poj--1006
- POJ 1006
- POJ 1742 Coins 多重背包用单调队列优化
- 新的开始
- php foreach循环时 注意事项
- android中常用的弹出提示框
- HDU4834 JZP Set 2014年百度之星程序设计大赛 - 初赛(第二轮) 数学
- POJ 1006
- ConcurrentHashMap原理分析
- hdu-1021 Fibonacci Again
- LUA中的metatable笔记 (metatable的默认元素)
- ASP.NET 对象 ViewState的用途
- JQuery插件之确认删除对话框
- c++中比较三个数的大小
- Qt中使用QSqlDatabase::removeDatabase()的正确方法
- 第十一章 字符串和字符串函数(字符串标准输入输出库函数)总结 140527