题目1142:Biorhythms
来源:互联网 发布:上古卷轴5ece捏脸数据 编辑:程序博客网 时间:2024/05/16 15:47
#include<stdio.h>#include<string.h>#include<stdlib.h> int cal(int a,int b,int c,int d){ int sum=21252; int a_23=23,b_28=28,c_33=33; int a_day=0,b_day=0,c_day=0; while(a>a_23) a_23+=23; a_day=a_23-a; while(b>b_28) b_28+=28; b_day=b_28-b; while(c>c_33) c_33+=33; c_day=c_33-c; int x; for(x=0;x<=21252;x++) { if((a_day+x)%23==0&&(b_day+x)%28==0&&(c_day+x)%33==0) break; } sum=x-d; if(sum<=0) sum+=21252; return sum;} int main(){ int a,b,c,d; int cas=1; while(scanf("%d %d %d %d",&a,&b,&c,&d)) { if(a==-1&&b==-1&&c==-1&&d==-1) break; printf("Case %d: the next triple peak occurs in %d days.\n",cas++,cal(a, b, c, d)); } return 0;}/************************************************************** Problem: 1142 User: cust123 Language: C++ Result: Accepted Time:10 ms Memory:1020 kb****************************************************************/
0 0
- 题目1142:Biorhythms
- 题目1142:Biorhythms
- 题目1142:Biorhythms
- 九度 oj 题目1142:Biorhythms
- NYOJ-题目(Math)--151------------------------------------Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- Biorhythms
- POJ 题目1006 Biorhythms(中国剩余定理)
- zoj1160 Biorhythms
- Android框架之路——NavigationView的使用(结合ToolBar)
- 【寒江雪】静态测试概述
- python之str.join operator.itemgetter
- [bzoj4828] [Hnoi2017]大佬
- 传说中的"全球云计算开源峰会"是个什么鬼?
- 题目1142:Biorhythms
- 腾讯课堂Day5作业
- 关于iOS中简单实现调用系统相机及相册功能
- Aizu2224 最大生成树??
- 初识 jquery(1)
- 介绍Scanner、Random类
- ios开发 使用系统相册和相机
- sdut2605——A^X mod P
- IMWeb训练营-ToDoList