結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2015-10-29 16:14:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,270 bytes |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 63,048 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 13:09:50 |
| 合計ジャッジ時間 | 1,640 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 38 WA * 5 |
ソースコード
#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 (n == 1) {
if (e - s == 1) std::cout << "FAILURE" << std::endl;
else std::cout << "SUCCESS" << std::endl;
return 0;
}
if (n == 0){
if(start[0] == end[0] && start[1] == end[1])std::cout << "FAILUER" << std::endl;
else std::cout << "SUCCESS" << std::endl;
}
if (n > 0) std::cout << "FAILURE" << std::endl;
return 0;
}
hanorver