結果
問題 |
No.197 手品
|
ユーザー |
![]() |
提出日時 | 2015-10-29 14:16:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,070 bytes |
コンパイル時間 | 502 ms |
コンパイル使用メモリ | 62,772 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-27 13:09:13 |
合計ジャッジ時間 | 1,726 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 WA * 19 |
ソースコード
#include<iostream> #include<string> #include<cmath> #include<algorithm> int main() { std::string start, end; long long n; std::cin >> start >> n >> end; int scoin = std::count(start.begin(), start.end(), 'o'), // 最初のコインの枚数 ecoin = std::count(end.begin(), end.end(), 'o'); // 最後のコインの枚数 // コインの数が最初と最後で違う if (scoin != ecoin) { std::cout << "SUCCESS" << std::endl; return 0; } /****************************************** 以下は最初と最後のコインの枚数が同じ *******************************************/ // コインの枚数が3枚か0枚ならばどうやってもあり得る状態になる if (scoin == 3 || scoin == 0) { std::cout << "FAILURE" << std::endl; return 0; } int s = -1, e = -1; if (start[0] != end[0])s = 0; if (start[1] != end[1]) { if (s != -1)e = 1; else s = 1; } if (start[2] != end[2])e = 2; if(s != -1) n -= e - s; if (n % 2 == 0) std::cout << "FAILURE" << std::endl; else std::cout << "SUCCESS" << std::endl; return 0; }