結果
問題 | No.361 門松ゲーム2 |
ユーザー |
![]() |
提出日時 | 2016-04-18 17:41:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 1,111 bytes |
コンパイル時間 | 685 ms |
コンパイル使用メモリ | 84,460 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 13:43:51 |
合計ジャッジ時間 | 1,566 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
/* -*- coding: utf-8 -*-** 361.cc: No.361 門松ゲーム2 - yukicoder*/#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<iostream>#include<string>#include<vector>#include<map>#include<set>#include<stack>#include<list>#include<queue>#include<deque>#include<algorithm>#include<numeric>#include<utility>#include<complex>#include<functional>using namespace std;/* constant */const int MAX_L = 500;/* typedef *//* global variables */int grndys[MAX_L + 1];bool used[MAX_L + 1];/* subroutines *//* main */int main() {int l, d;cin >> l >> d;for (int k = 6; k <= l; k++) {memset(used, false, sizeof(used));int maxl1 = k / 3;for (int l1 = 1; l1 < maxl1; l1++) {int maxl2 = (k + 1 - l1) / 2;for (int l2 = l1 + 1; l2 < maxl2; l2++) {int l3 = k - (l1 + l2);if (l3 <= l1 + d)used[grndys[l1] ^ grndys[l2] ^ grndys[l3]] = true;}}int g = 0;while (used[g]) g++;grndys[k] = g;}//printf("%d\n", grndys[l]);cout << (grndys[l] != 0 ? "kado" : "matsu") << endl;return 0;}