定理证明:https://blog.csdn.net/d_x_d/article/details/48466957

https://blog.csdn.net/lyy289065406/article/details/6648551

关键思路在于构造一个每部分膜另外一个不包含在部分内的部分的余数是1  然后把各部分分别乘以对应的余数

其中题目给出的第一天天数  就是  (n+d)%xn 的余数 不用处理

 #include<iostream>
using namespace std; int main(void)
{
int p,e,i,d;
int time=;
while(cin>>p>>e>>i>>d)
{
if(p==- && e==- && i==- && d==-)
break; int lcm=; // lcm(23,28,33)
//找到分别余1的x1*x2*k的k然后乘以余数
//x1*x2*k%x3
int n=(*p+*e+*i-d+)%;
if(n==)
n=;
cout<<"Case "<<time++<<": the next triple peak occurs in "<<n<<" days."<<endl;
}
return ;
}

Biorhythms POJ - 1006 中国剩余定理的更多相关文章

  1. POJ 1006 中国剩余定理

    #include <cstdio> int main() { // freopen("in.txt","r",stdin); ; while(sca ...

  2. POJ 1006-Biorhythms,中国剩余定理,学信安的路过!

                                                       Biorhythms 我竟然1A了, 终于从一天的浑噩中找回点自信了.人生第一次做中国剩余定理的题 ...

  3. POJ - 2891 中国剩余定理

    \(mod\)存在不互素情况下的CRT #include<iostream> #include<algorithm> #include<cstdio> #inclu ...

  4. POJ1006——中国剩余定理

    题目:http://poj.org/problem?id=1006 中国剩余定理:x= m/mj + bj + aj 讲解:http://www.cnblogs.com/MashiroSky/p/59 ...

  5. POJ 1006:Biorhythms 中国剩余定理

    Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 121194   Accepted: 38157 Des ...

  6. 数论E - Biorhythms(中国剩余定理,一水)

    E - Biorhythms Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Subm ...

  7. POJ1006 Biorhythms —— 中国剩余定理

    题目链接:https://vjudge.net/problem/POJ-1006 Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total ...

  8. acm数论之旅--中国剩余定理

    ACM数论之旅9---中国剩余定理(CRT)(壮哉我大中华╰(*°▽°*)╯)   中国剩余定理,又名孙子定理o(*≧▽≦)ツ 能求解什么问题呢? 问题: 一堆物品 3个3个分剩2个 5个5个分剩3个 ...

  9. poj1006中国剩余定理

    Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 103506   Accepted: 31995 Des ...

随机推荐

  1. 分享vs低版本开发的项目到VS高版本时遇到的4个小问题解决之记录

    分享vs低版本开发的项目到VS高版本时遇到的4个小问题解决之记录 原文首发: http://anforen.com/wp/2017/08/extensionattribute_compilerserv ...

  2. .net core jwt

    https://www.cnblogs.com/JacZhu/p/6837676.html

  3. poj2104 主席树裸题

    空间大小:n*lgn 复杂度:建树n*lgn  查询lgn #include <cstdio> #include <iostream> #include <algorit ...

  4. (第十三周)Final阶段用户调查报告

    项目名:食物链教学工具 组名:奋斗吧兄弟 组长:黄兴 组员:李俞寰.杜桥.栾骄阳.王东涵 用户调查报告 调查时间:2016年12月1日  21:00——2016年12月3日  12:00 项目分享链接 ...

  5. Echatrs 中PIE饼图中间位置怎么显示总数值?

    title: { text: '总资产', subtext: '2000000.00', x: 'center', y: 'center' }图例:

  6. Shell脚本命令图片

    查看相关文档:shell脚本1  shell脚本2

  7. 使用PHPExcel导出数据库表结构及内容

    导出表结构: mysql> desc user ; +----------+--------------+------+-----+---------------------+--------- ...

  8. 2019省赛训练组队赛3.31周四-17fj

    https://vjudge.net/contest/289558#overview A - Frog Therearex frogs and y chicken in a garden. Kim f ...

  9. 封装day.js

    封装day.js import dayjs from 'dayjs' import 'dayjs/locale/zh-cn' import relativeTime from 'dayjs/plugi ...

  10. Eclipse Todo Tasks 任务试图

    java - Find TODO tags in Eclipse - Stack Overflowhttps://stackoverflow.com/questions/16903046/find-t ...