POJ:1006--BIORHYTHM(生理周期计算)
原题如下:
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 110700 | Accepted: 34443 |
Description
Since the three cycles have different periods, the peaks of the three cycles generally occur at different times. We would like to determine when a triple peak occurs (the peaks of all three cycles occur in the same day) for any person. For each cycle, you will be given the number of days from the beginning of the current year at which one of its peaks (not necessarily the first) occurs. You will also be given a date expressed as the number of days from the beginning of the current year. You task is to determine the number of days from the given date to the next triple peak. The given date is not counted. For example, if the given date is 10 and the next triple peak occurs on day 12, the answer is 2, not 3. If a triple peak occurs on the given date, you should give the number of days to the next occurrence of a triple peak.
Input
Output
Case 1: the next triple peak occurs in 1234 days.
Use the plural form ``days'' even if the answer is 1.
Sample Input
0 0 0 0 0 0 0 100 5 20 34 325 4 5 6 7 283 102 23 320 203 301 203 40 -1 -1 -1 -1
Sample Output
Case 1: the next triple peak occurs in 21252 days. Case 2: the next triple peak occurs in 21152 days. Case 3: the next triple peak occurs in 19575 days. Case 4: the next triple peak occurs in 16994 days. Case 5: the next triple peak occurs in 8910 days. Case 6: the next triple peak occurs in 10789 days.
Source
#include<cstdio>
using namespace std;
#define N 21252
int main(){
int p,e,i,d,caseNo = 0;
while( cin >> p >> e >> i >> d && p != -1){
++ caseNo;
int k;
for( k = d+1; (k-p)%23 ; ++k);
for(; (k-e)%28; k+= 23);
for(; (k-i)%33; k+= 23*28);
cout << "Case " << caseNo <<
": the next triple peak occurs in" << k-d <<" days\n";
}
return 0;
}
POJ:1006--BIORHYTHM(生理周期计算)相关推荐
- Poj 1006 / OpenJudge 2977 1006 Biorhythms/生理周期
1.链接地址: http://poj.org/problem?id=1006 http://bailian.openjudge.cn/practice/2977 2.题目: Biorhythms Ti ...
- POJ 2977 生理周期 解题报告
2977 : 生理周期 总时间限制: 1000ms 内存限制: 65536kB 描述 人生来就有三个生理周期,分别为体力.感情和智力周期,它们的周期长度为23天.28天和33天.每一个周期中有一天是高 ...
- PKU ACM 1006 生理周期
题目链接:Biorhythms 生理周期 Description 人生来就有三个生理周期,分别为体力.感情和智力周期,它们的周期长度为23天.28天和33天.每一个周期中有一天是高峰.在高峰这天,人会 ...
- Bailian2977 生理周期【枚举+中国剩余定理】
2977:生理周期 总时间限制: 1000ms 内存限制: 65536kB 描述 人生来就有三个生理周期,分别为体力.感情和智力周期,它们的周期长度为23天.28天和33天.每一个周期中有一天是高峰. ...
- c语言编程 生理周期的程序,生理周期(示例代码)
题目链接: poj 1006 http://poj.org/problem?id=1006 NOI题库 http://noi.openjudge.cn/ch0201/1978/ Time Limi ...
- POJ 1006 Biorhythms
题目大意: 人生来就有三个生理周期,分别为体力.感情和智力周期,它们的周期长度为23天.28天和33天每一个周期.中有一天是高峰.在高峰这天,人会在相应的方面表现出色.例如,智力周期的高峰,人会思维敏 ...
- OpenJ_Bailian 4148 生理周期
题目地址: https://vjudge.net/problem/OpenJ_Bailian-4148 人生来就有三个生理周期,分别为体力周期.感情周期和智力周期,它们的周期长度分别为23天.28天和 ...
- 百练OJ:4148:生理周期
描述 人生来就有三个生理周期,分别为体力周期.感情周期和智力周期,它们的周期长度分别为23天.28天和33天.每一个周期中有一天是高峰.在高峰这天,人会在相应的方面表现出色.例如,在智力周期的高峰,人 ...
- poj 1006(中国剩余定理+模板题)
题意:人自出生起就有体力,情感和智力三个生理周期,分别为23,28和33天.一个周期内有一天为峰值,在这一天,人在对应的方面(体力,情感或智力)表现最好.通常这三个周期的峰值不会是同一天.现在给出三个 ...
最新文章
- [物理学与PDEs]第2章习题参考解答
- centos 如何登陆mysql_[CentOS 0010] CentOS 配置mysql允许远程登录
- JAVA不使用POI给Word文档添加水印
- 【position也可以很复杂】当弹出层遇上了鼠标定位(下)
- mysql模糊查询不会区分大小写_MySQL模糊查询(like)时区分大小写
- Map转xml格式字符串
- 在Ubuntu系统下如何将chrome浏览器的bookmarks导出到本地
- SpringBoot学习笔记(8):事物处理
- C# 定义了 7 种变量类别:静态变量、实例变量、数组元素、值参数、引用参数、输出参数和局部变量
- opencv3.4.3的DNN模块调用bvlc_googlenet.caffemodel实现图像分类
- HCIBench_2.3.1部署_VSAN_测试工具
- idea2020不显示光标所在位置的方法名
- hdu-2602POJ-3624---01背包裸题
- Android 动画分类
- 数据分析十年来电影票房数据
- java nio wakeup_Java NIO wakeup实现原理
- 【数据聚类】基于多元宇宙优化DBSCAN实现数据聚类分析附matlab代码
- 【线上沙龙】WeTest携手Testerhome共探DevOps下的质量保障
- pyecharts 在地图上根据经纬度和量值,画出散点图/热力图
- 【算法】牛顿迭代法求平方根的原理和误差分析