結果

問題 No.197 手品
ユーザー feeling_master
提出日時 2015-05-02 11:55:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 682 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 55,512 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 09:12:37
合計ジャッジ時間 1,587 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

int p(string s){
	int w;
	if (s == "ooo")
		w = 1;
	else if(s == "xxx")
		w = -1;
	else if(s == "oox")
		w = 2;
	else if(s == "oxo")
		w = 3;
	else if(s == "xoo")
		w = 4;
	else if(s == "xxo")
		w = -2;
	else if(s == "xox")
		w = -3;
	else
		w = -4;
	return(w);
}

int q(int b, int a){
	int x;
	if (b * a < 0)
		return -1;

	if (b * a == 1)
		return 0;
		
	x = b - a;
	if (x < 0)
		x = x * (-1);

	return(x);
}

int main(){
	string b,a;
	int N;


	cin >> b >> N >> a;

	int i = q(p(b), p(a));

	if (i != 0 && i != -1 && N % i != 0)
		i = -1;

	if (i < 0)
		cout << "SUCCESS\n";
	else
		cout << "FAILURE\n";

	cin >> i;

}
0