結果

問題 No.197 手品
ユーザー _shim0123_
提出日時 2015-05-02 18:07:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 857 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 64,264 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 09:14:31
合計ジャッジ時間 1,688 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

void swap(char* x, char* y) {
	char tmp = *x;
	*x = *y;
	*y = tmp;
}

int main(void) {
	string be, af;
	long long N;
	int num = -1;
	int cnt = 0;

	cin >> be >> N >> af;

	for(int i = -1; i <= 1; i++){
		string tmp = be;
		for(int j = -1; j <= 1; j++){
			swap(tmp[i*j + 1], tmp[1]);
			if(tmp == af){
				if(num == -1){
					num=abs(i) *(j + 3) / 2;
				}
				else{
					num = min(abs(i) *(j + 3) / 2, num);
				}
			}
		}
	}

	if((af.find("xx") != string::npos || af.find("oo") != string::npos)){
		if(num != -1 && N - num >= 0){
			cout << "FAILURE" << endl;
		}
		else{
			cout << "SUCCESS" << endl;
		}
	}
	else{
		if(num != -1 && N - num >= 0&&(N-num)%2==0){
			cout << "FAILURE" << endl;
		}
		else{
			cout << "SUCCESS" << endl;
		}
	}

	return 0;
}
0