結果

問題 No.197 手品
ユーザー Rp7rf
提出日時 2015-04-28 23:57:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,485 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 72,716 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 07:21:18
合計ジャッジ時間 1,723 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 7 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  string sb,sf;
  int n;
  cin>>sb>>n>>sf;
  bool ans = false;
  if(sb[0] == 'o' && sb[1] == 'x' && sb[2] == 'x' &&
     sf[0] == 'x' && sf[1] == 'x' && sf[2] == 'o' &&
     n <= 2){
    ans = true;
  }else if(sb[0] == 'x' && sb[1] == 'x' && sb[2] == 'o' &&
	   sf[0] == 'o' && sf[1] == 'x' && sf[2] == 'x' &&
	   n <= 2){
    ans = true;
  }else if(sb[0] == 'o' && sb[1] == 'o' && sb[2] == 'x' &&
	   sf[0] == 'x' && sf[1] == 'o' && sf[2] == 'o' &&
	   n <= 1){
    ans = true;
  }else if(sb[0] == 'x' && sb[1] == 'o' && sb[2] == 'o' &&
	   sf[0] == 'o' && sf[1] == 'o' && sf[2] == 'x' &&
	   n <= 1){
    ans = true;
  }else if(n == 0 && sb != sf){
    ans = true;
  }else{
    int sfnum = 0;
    int sbnum = 0;
    rep(i,sb.size()){
      if(sb[i] == 'o')sbnum++;
    }
  
    rep(i,sf.size()){
      if(sf[i] == 'o')sfnum++;
    }

    if(sfnum != sbnum){
      ans = true;
    }
  }
  cout<<(ans?"SUCCESS":"FALURE")<<endl;
}
0