結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2016-07-04 10:45:05 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 1,047 bytes |
コンパイル時間 | 134 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 03:48:42 |
合計ジャッジ時間 | 1,366 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%s", before); | ^~~~~~~~~~~~~~~~~~~ main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &n); | ^~~~~~~~~~~~~~~ main.c:12:5: warning: ignoring return value of ‘scanf’ 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){ if(after[0] == after[1] && after[1] == after[2]) printf("FAILURE"); else printf("SUCCESS"); } else printf("FAILURE"); } } else if(n >= 2){ if(count != 0) printf("SUCCESS"); else printf("FAILURE"); } printf("\n"); return 0; }