結果

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

ソースコード

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 && (num == -1 || (N - num) % 2 != 0)){
				num = abs(i) *(j + 3) / 2;
			}
		}
	}

	if(num==-1||(N-num)<0||(N-num)%2!=0){
		cout << "SUCCESS" << endl;
	}
	else{
		cout << "FAILURE" << endl;
	}

	return 0;
}
0