結果

問題 No.197 手品
ユーザー 184
提出日時 2015-04-28 23:54:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 40,632 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 07:20:53
合計ジャッジ時間 1,459 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 18 WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         char s1[10],s2[10];int n;scanf("%s%d%s",s1,&n,s2);
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <map>


using namespace std;

int main(){ 
	char s1[10],s2[10];int n;scanf("%s%d%s",s1,&n,s2);
	int cnt1=0,cnt2=0;
	int dcnt=0;
	for(int i=0;i<3;i++){
		if(s1[i]=='o')cnt1++;
		if(s2[i]=='o')cnt2++;
		if(s1[i]!=s2[i])dcnt++;
	}
	if(cnt1!=cnt2)printf("SUCCESS\n");
	else if(dcnt==0){
		if(n%2==0)printf("FAILURE\n");
		else printf("SUCCESS\n");
	}
	else if(dcnt==2){
		if(s2[0]!=s2[2]){
			if(n%2==0)printf("SUCCESS\n");
			else printf("FAILURE\n");
		}
		else{
			if(n>1)printf("FAILURE\n");
			else printf("SUCCESS\n");
		}
	}
	//printf("%d\n",ans); 
	return 0;
}
0