結果
問題 |
No.197 手品
|
ユーザー |
|
提出日時 | 2016-07-04 10:00:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 964 bytes |
コンパイル時間 | 148 ms |
コンパイル使用メモリ | 23,424 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 13:33:19 |
合計ジャッジ時間 | 1,347 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%s", before); | ~~~~~^~~~~~~~~~~~~~ main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%s", after); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> int main(void) { char before[4], after[4]; char tmp; int i, n, count = 0; scanf("%s", before); scanf("%d", &n); scanf("%s", after); for(i = 0; i < 3; i++){ if(before[i] == 'o') count++; if(after[i] == 'o') count--; } if(n == 0){ if(strcmp(before, after) == 0) printf("FAILURE"); else printf("SUCCESS"); } else if(n == 1){ if(count != 0) printf("SUCCESS"); else{ tmp = after[2]; after[2] = after[0]; after[0] = tmp; if(strcmp(before, after) == 0) printf("SUCCESS"); else printf("FAILURE"); } } else if(n >= 2){ if(count != 0) printf("SUCCESS"); else printf("FAILURE"); } printf("\n"); return 0; }