64,693
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
const int Physical = 23;
const int Emotional = 28;
const int Intellectual = 33;
int main()
{
int p, e, i, d;
cin >> p >> e >> i >> d;
int index = 1;
while (p != -1)
{
p += 23;
while (1)
{
while (p > e)
e += Emotional;
while (p < e)
p += Physical;
if (p == e && (e - i) % Intellectual == 0) break;
else if (p == e)
e += Emotional;
}
cout << "Case " << index << ": the next triple peak occurs in " << p - d << " days.";
cin >> p >> e >> i >> d;
index++;
}
return 0;
}
#include <iostream>
using namespace std;
const int Physical = 23;
const int Emotional = 28;
const int Intellectual = 33;
int main()
{
int p, e, i, d;
cin >> p >> e >> i >> d;
int index = 1;
while (p != -1)
{
if (p == e && p == i && p == d)
p += Physical;
while (1)
{
while (p > e)
e += Emotional;
while (p < e)
p += Physical;
if (p == e && (e - i) % Intellectual == 0) break;
else if (p == e)
e += Emotional;
}
cout << "Case " << index << ": the next triple peak occurs in " << p - d << " days." << endl;
cin >> p >> e >> i >> d;
index++;
}
return 0;
}