UVA756 Biorhythms

crt

crt裸题

因为模数已知所以有些值能直接求

#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
ll p,e,i,d,lcm=,ans,t;
int main(){
while(){
cin>>p>>e>>i>>d;
if(p==-) break;
ans=(*p+*e+*i-d+lcm)%lcm; //exgcd可以预先算
printf("Case %lld: the next triple peak occurs in %lld days.\n",++t,ans ? ans:lcm);
}return ;
}

UVA756 Biorhythms的更多相关文章

  1. 【题解】UVA756 Biorhythms (中国剩余定理)

    UVA756:https://www.luogu.org/problemnew/show/UVA756 思路 几乎是裸的中国剩余定理模板题 但是需要注意的是此题并不是求最小正整数解 而是求大于d的解 ...

  2. 中国剩余定理+扩展中国剩余定理 讲解+例题(HDU1370 Biorhythms + POJ2891 Strange Way to Express Integers)

    0.引子 每一个讲中国剩余定理的人,都会从孙子的一道例题讲起 有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二.问物几何? 1.中国剩余定理 引子里的例题实际上是求一个最小的x满足 关键是,其中 ...

  3. poj1006 / hdu1370 Biorhythms (中国剩余定理)

    Biorhythms 题意:读入p,e,i,d 4个整数,已知(n+d)%23=p;   (n+d)%28=e;   (n+d)%33=i ,求n .        (题在文末) 知识点:中国剩余定理 ...

  4. poj 1006:Biorhythms(水题,经典题,中国剩余定理)

    Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 110991   Accepted: 34541 Des ...

  5. POJ 1006 - Biorhythms (中国剩余定理)

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

  6. [POJ] #1006# Biorhythms : 最小公倍数/同余问题

    一. 题目 Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 127263   Accepted: 403 ...

  7. Poj 1006 / OpenJudge 2977 1006 Biorhythms/生理周期

    1.链接地址: http://poj.org/problem?id=1006 http://bailian.openjudge.cn/practice/2977 2.题目: Biorhythms Ti ...

  8. 算法练习之:Biorhythms

    Biorhythms Time Limit: 1000MS Memory Limit: 10000KB  Problem Description Some people believe that th ...

  9. Biorhythms(中国剩余定理)

    Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 127339   Accepted: 40342 Des ...

随机推荐

  1. 源代码的管理与在eclipse中使用maven进行代码测试

    管理源代码的工具 开发历史记录 SVN :集中式的源代码管理工具 通常必须连到公司的服务器上才能正常工作 (提交代码,查看代码的历史记录 查看代码的分支) 在公司中开发项目时 每天必须至少提交(Com ...

  2. Memcached 简单利用和简单了解(Mac的安装和使用)

    Memcached 是一种用于分布式应用的一种缓存机制.应用也比较广泛.这里来学习一下. 首先Memcached 是分布式网站架构都需要用到的缓存机制.缓存就是服务器利用多余的空间上开辟了一个储存空间 ...

  3. poj3614 Sunscreen【贪心】

    Sunscreen Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11772   Accepted: 4143 Descri ...

  4. hdu-4283 You Are the One 区间dp,

    题意:n个人排队上台,每个人有一屌丝值D,他的不满意值=D*(k-1)(k为他前面的总人数). 求整个队列不满意值之和的最小值.你只有一个操作,就是把队首的人塞进小黑屋,也就是压入栈中,后面的人就被提 ...

  5. HDFS Users Guide

    Purpose This document is a starting point for users working with Hadoop Distributed File System (HDF ...

  6. Linux替换字符串

    sed命令批量替换多个文件中的字符串: 命令:sed -i “s/原字符串/新字符串/g” `grep 原字符串 -rl 所在目录` 例如:我要把 xy 替换为 mn,执行命令: sed -i “s/ ...

  7. requests爬取百度贴吧:python 美女 3

    import requests import sys class Tieba(object): def __init__(self, tieba_name, pn): self.tieba_name ...

  8. 菜鸟教程之工具使用——Git的基本使用

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/liushuijinger/article/details/37569907 Git是进来比較火的版本 ...

  9. HashMap(不是线程安全)与ConcurrentHashMap(线程安全)

    HashMap不是线程安全的 ConcurrentHashMap是线程安全的 从JDK1.2起,就有了HashMap,正如前一篇文章所说,HashMap不是线程安全的,因此多线程操作时需要格外小心. ...

  10. 人活着系列之芳姐和芳姐的猪(Floyd)

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2929 这个题一方面数据水,另一方面就是思维水, ...