結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-04-28 23:47:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 583 bytes |
| コンパイル時間 | 250 ms |
| コンパイル使用メモリ | 40,884 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 07:18:52 |
| 合計ジャッジ時間 | 1,360 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 27 WA * 16 |
コンパイルメッセージ
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);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#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)printf("FAILURE\n");
else if(dcnt==2){
if(s1[1]!=s2[1]){
if(n%2)printf("SUCCESS\n");
else printf("FAILURE\n");
}
else{
if(n>1)printf("SUCCESS\n");
else printf("FAILURE\n");
}
}
//printf("%d\n",ans);
return 0;
}
184