题解 | #Biorhythms#

Biorhythms

https://www.nowcoder.com/practice/aa66f85934c142f3af2da111dc864d9f

#include <iostream>
#include <cstring> 
#include <algorithm>
#include <math.h>
#include <string.h> 
#include <stdlib.h>
using namespace std;
int main(){
	int body = 23;
	int motion = 28;
	int intell = 33;

	int p, e, i ,d, day;
	cin >> p >> e >> i >> d;
    for(day = 1;day <= 21252 ; day++){
        if ((day-p)%body == 0 && (day-e)%motion == 0 && (day-i)%intell == 0) break;
    }
	cout << "Case: the next triple peak occurs in "<< day-d << " days.";
}

全部评论

相关推荐

09-01 11:31
门头沟学院 Java
buul:七牛云的吧,感觉想法是好的,但是大家没那么多时间弄他这个啊。。。不知道的还以为他是顶尖大厂呢还搞比赛抢hc,只能说应试者的痛苦考察方是无法理解的,他们只会想一出是一出
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务