mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 20:28:48 +00:00
1300. 生物节律
https://www.acwing.com/problem/content/submission/code_detail/13596552/
This commit is contained in:
parent
ff8924cc3a
commit
004bd8f492
27
AcWing/1300/1300.cpp
Normal file
27
AcWing/1300/1300.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
int t, p, e, i, d;
|
||||||
|
|
||||||
|
int gcd(int a, int b) {
|
||||||
|
return b ? gcd(b, a % b) : a;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lcm(int a, int b) {
|
||||||
|
return a / gcd(a, b) * b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
|
||||||
|
while (cin >> p >> e >> i >> d, ~p && ~e && ~i && ~d) {
|
||||||
|
int l = 21252,
|
||||||
|
ans = (5544 * p + 14421 * e + 1288 * i - d + l) % l;
|
||||||
|
cout << "Case " << ++t << ": the next triple peak occurs in " << (ans ? ans : l) << " days." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user