Biorhythms POJ - 1006 中国剩余定理
定理证明: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 中国剩余定理的更多相关文章
- POJ 1006 中国剩余定理
#include <cstdio> int main() { // freopen("in.txt","r",stdin); ; while(sca ...
- POJ 1006-Biorhythms,中国剩余定理,学信安的路过!
Biorhythms 我竟然1A了, 终于从一天的浑噩中找回点自信了.人生第一次做中国剩余定理的题 ...
- POJ - 2891 中国剩余定理
\(mod\)存在不互素情况下的CRT #include<iostream> #include<algorithm> #include<cstdio> #inclu ...
- POJ1006——中国剩余定理
题目:http://poj.org/problem?id=1006 中国剩余定理:x= m/mj + bj + aj 讲解:http://www.cnblogs.com/MashiroSky/p/59 ...
- POJ 1006:Biorhythms 中国剩余定理
Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 121194 Accepted: 38157 Des ...
- 数论E - Biorhythms(中国剩余定理,一水)
E - Biorhythms Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Subm ...
- POJ1006 Biorhythms —— 中国剩余定理
题目链接:https://vjudge.net/problem/POJ-1006 Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total ...
- acm数论之旅--中国剩余定理
ACM数论之旅9---中国剩余定理(CRT)(壮哉我大中华╰(*°▽°*)╯) 中国剩余定理,又名孙子定理o(*≧▽≦)ツ 能求解什么问题呢? 问题: 一堆物品 3个3个分剩2个 5个5个分剩3个 ...
- poj1006中国剩余定理
Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 103506 Accepted: 31995 Des ...
随机推荐
- Php7 开发笔记
Ubuntu环境安装 http://www.jianshu.com/p/1d312d9f1be1 sudo apt-get install python-software-properties sof ...
- 牛客练习赛38 D 题 出题人的手环 (离散化+树状数组求逆序对+前缀和)
链接:https://ac.nowcoder.com/acm/contest/358/D来源:牛客网 出题人的手环 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K,其他 ...
- net core 端口设置
在supervisor的启动配置里面增加环境变量: environment=ASPNETCORE_URLS='http://*:5001'
- RabbitMQ防止消息丢失
转载请注明出处 0.目录 RabbitMQ-从基础到实战(1)— Hello RabbitMQ RabbitMQ-从基础到实战(3)— 消息的交换 1.简介 RabbitMQ中,消息丢失可以简单的分为 ...
- [2017BUAA软工助教]个人项目小结
2017BUAA个人项目小结 一.作业链接 http://www.cnblogs.com/jiel/p/7545780.html 二.评分细则 0.注意事项 按时间完成并提交--正常评分 晚交一周以内 ...
- Java 集合的简单理解
集合(容器) Java的集合类分别是Collection接口和Map接口派生而来. Collection接口 对于实现Collection接口的子类,都会实现Collection接口中抽象方法,所以他 ...
- vue-lazyload简单使用
vue-lazyload简单使用 npm地址:https://www.npmjs.com/package/vue-lazyload github地址:https://github.com/hilong ...
- Jenkins Installing and migration
JAVA_Zookeeper_hadoop - CSDN博客https://blog.csdn.net/wangmuming Installing Jenkins on Red Hat distrib ...
- JS XMLHttpRequesst对象 http post的五种请求状态
记录一下js中对http请求的几种状态,下附代码 readyState 存有 XMLHttpRequest 的状态.从 0 到 4 发生变化. 0: 请求未初始化 1: 服务器连接已建立 2: 请求已 ...
- HDU 3900 Unblock Me
题目:Unblock Me 链接:Here 题意:一个游戏,看图就基本知道题意了,特殊的是:1. 方块长度为3或2,宽度固定是1.2. 地图大小固定是6*6,从0开始. 3. 出口固定在(6,2).4 ...