結果

問題 No.197 手品
ユーザー ldsyb
提出日時 2016-03-26 18:37:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 841 bytes
コンパイル時間 976 ms
コンパイル使用メモリ 60,376 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-20 03:47:35
合計ジャッジ時間 1,909 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
   string ans[] = {"SUCCESS","FAILURE"};
   int n;
   string before,after;
   cin >> before >> n >> after;
   if(count(before.begin(),before.end(),'o') != count(after.begin(),after.end(),'o')) cout << ans[0] << endl;
   else{
      if(n == 0) cout << ans[before == after] << endl;
      else if(n == 1){
         string tmp = before;
         char c = tmp[0];
         tmp[0] = tmp[1];
         tmp[1] = c;
         if(tmp == after){
            cout << ans[1] << endl;
            return 0;
         }
         tmp = before;
         c = tmp[1];
         tmp[1] = tmp[2];
         tmp[2] = c;
         if(tmp == after){
            cout << ans[1] << endl;
            return 0;
         }
         cout << ans[0] << endl;
      }else cout << ans[1] << endl;
   }
}
0