题解 | #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.";
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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