結果
| 問題 | No.197 手品 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-09-22 14:59:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,010 bytes |
| コンパイル時間 | 547 ms |
| コンパイル使用メモリ | 58,844 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 03:42:45 |
| 合計ジャッジ時間 | 1,609 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
#include <iostream>
using namespace std;
#include <cstdio>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double lb;
/* ここからが本編 */
int main(void)
{
int i,j,k;
char before[4];
char after[4];
char tmp[4];
int n;
char cnt = 0;
char success = 1;
cin >> before >> n >> after;
rep(i,3) {
if(before[i] == 'o') cnt++;
}
rep(i,3) {
if(after[i] == 'o') cnt--;
}
if(cnt != 0) ;
else if(success) {
if(n == 0) {
if( strcmp(before,after) == 0) success = 0;
}
else if(n >= 2) success = 0;
else { strcpy(tmp,before);
swap(tmp[0],tmp[1]);
if( strcmp(tmp,after) == 0 ) success = 0;
swap(before[1],before[2]);
if( strcmp(before,after) == 0 ) success = 0;
}
}
if(success) cout << "SUCCESS\n";
else cout << "FAILURE\n";
return 0;
}