結果
| 問題 | 
                            No.197 手品
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kongarishisyamo
                         | 
                    
| 提出日時 | 2016-02-24 18:11:30 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 948 bytes | 
| コンパイル時間 | 521 ms | 
| コンパイル使用メモリ | 61,304 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-27 13:19:39 | 
| 合計ジャッジ時間 | 1,745 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 37 WA * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:50:36: warning: ‘aloc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   50 |                         N-=abs(aloc-bloc);
      |                                ~~~~^~~~~
main.cpp:50:36: warning: ‘bloc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
            
            ソースコード
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main(){
	string Sb,Sa;
	long long N;
	int bloc,aloc;
	int bmaru=0,bbatu=0,amaru=0,abatu=0;
	cin>>Sb;
	cin>>N;
	cin>>Sa;
	if(Sa==Sb){
		if(N==1) cout<<"SUCCESS"<<endl;
		else cout<<"FAILURE"<<endl;
	}
	else if(Sb=="ooo"){
		if(Sa=="ooo") cout<<"FAILURE"<<endl;
		else cout<<"SUCCESS"<<endl;
	}
	else if(Sb=="xxx"){
		if(Sa=="xxx") cout<<"FAILURE"<<endl;
		else cout<<"SUCCESS"<<endl;
	}
	else{
		for(int i=0;i<3;i++){
			if(Sb[i]=='o') bmaru++;
			else bbatu++;
			if(Sa[i]=='o') amaru++;
			else abatu++;
		}
		if(amaru!=bmaru) cout<<"SUCCESS"<<endl;
		else{
			if(bmaru==1){
				for(int i=0;i<3;i++){
					if(Sb[i]=='o') bloc=i;
					if(Sa[i]=='o') aloc=i;
				}
			}
			else{
				for(int i=0;i<3;i++){
					if(Sb[i]=='x') bloc=i;
					if(Sa[i]=='x') aloc=i;
				}
			}
			N-=abs(aloc-bloc);
			if(N>=0) cout<<"FAILURE"<<endl;
			else cout<<"SUCCESS"<<endl;
		}
	}
}
            
            
            
        
            
kongarishisyamo