题解 | Biorhythms

Biorhythms

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

#include <iostream>

using namespace std;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int p, e, i, d;
    cin >> p >> e >> i >> d;
    for(int j = 1; j <= 21252; j++)
    {
        if((d + j - p) % 23 == 0 && (d + j - e) % 28 == 0 && (d + j - i) % 33 == 0)
        {
            cout << "Case: the next triple peak occurs in " << j << " days.";
        }
    }
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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