結果

問題 No.197 手品
ユーザー Mayimg
提出日時 2018-12-05 12:58:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 789 bytes
コンパイル時間 1,611 ms
コンパイル使用メモリ 167,816 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 03:56:22
合計ジャッジ時間 2,637 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	string s, t;
	int n;
	cin >> s >> n >> t;
	int a = 0, b = 0;
	for(int i = 0; i < 3; i++) {
		if(s[i] == 'o') {
			a++;
		}
		if(t[i] == 'o') {
			b++;
		}
	}
	if(a != b) {
		cout << "SUCCESS" << endl;
		return 0;
	}
	if(n == 0) {
		if(s == t) {
			cout << "FAILURE" << endl;
			return 0;
		}
		else {
			cout << "SUCCESS" << endl;
			return 0;
		}
	}
	if(n > 1) {
		cout << "FAILURE" << endl;
		return 0;
	}
	if(n == 1) {
		string p = s, q = s;
		swap(p[0], p[1]);
		swap(q[1], q[2]);
		if(t == p || t == q) {
			cout << "FAILURE" << endl;
			return 0;
		}
		else {
			cout << "SUCCESS" << endl;
			return 0;
		}
	}
	
	return 0;	
}
0