結果
| 問題 | 
                            No.197 手品
                             | 
                    
| コンテスト | |
| ユーザー | 
                             fiord
                         | 
                    
| 提出日時 | 2015-05-23 10:52:01 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 762 bytes | 
| コンパイル時間 | 408 ms | 
| コンパイル使用メモリ | 23,808 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-27 09:44:07 | 
| 合計ジャッジ時間 | 1,288 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 40 WA * 3 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s",before);
      |         ~~~~~^~~~~~~~~~~~~
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         int n;  scanf("%d",&n);
      |                 ~~~~~^~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf(" %s",after);
      |         ~~~~~^~~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
	char before[4],after[4];
	scanf("%s",before);
	int n;	scanf("%d",&n);
	scanf(" %s",after);
	short bo=0,ao=0;
	for(int i=0;i<3;i++){
		if(before[i]=='o')	bo++;
		if(after[i]=='o')	ao++;
	}
	if(bo!=ao)	printf("SUCCESS\n");
	else{
		if(n==0){
			if(strcmp(before,after)==0)	printf("SUCCESS\n");
			else 	printf("FAILURE\n");
		}
		else if(n==1){
			char be2[4];	sprintf(be2,"%c%c%c",before[0],before[2],before[1]);
			char be3[4];	sprintf(be3,"%c%c%c",before[1],before[0],before[2]);
			before[3]='\0';	after[3]='\0';	be2[3]='\0';	be3[3]='\0';
			if(strcmp(be2,after)==0||strcmp(be3,after)==0)	printf("FAILURE\n");
			else 	printf("SUCCESS\n");
		}
		else 	printf("FAILURE\n");
	}
	return 0;
}
            
            
            
        
            
fiord