题解 | Biorhythms
#include <iostream> using namespace std; int main() { int p,e,i,d; while(cin>>p>>e>>i>>d){ int temp=1; for(;;temp++){ if((temp-p)%23==0&&(temp-e)%28==0&&(temp-i)%33==0)break; } cout<<"Case: the next triple peak occurs in "<<temp-d<<" days."<<endl; } }
按照条件一个一个搜