PKU1006

PKU JugeOnlineの1006番の問題。

いつピークがくるかという問題。

#include <iostream>
using namespace std;
int main(){
  int p, e, i, d, res;
  int n = 1;
  int max = 21252;
  while (cin >> p >> e >> i >> d && p != -1){
    res = ((5544*p + 14421*e + 1288*i)%max - d + max)%max;
    if (res==0)
      res = max;
    cout << "Case " << n++ << ": the next triple peak occurs in " << res << " days.\n";
  }
}
 
最終更新:2009年01月09日 20:52
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。