結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
TLwiegehtt
|
| 提出日時 | 2015-07-12 03:46:54 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 913 bytes |
| コンパイル時間 | 132 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-27 09:57:54 |
| 合計ジャッジ時間 | 1,265 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 WA * 13 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%s", before);
| ^~~~~~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s", after);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
int i,n;
int ans = 1;
char before[10];
char after[10];
scanf("%s", before);
scanf("%d", &n);
scanf("%s", after);
if(n == 0){
for(i=0;before[i] == after[i];i++);
if(i == 3){ ans = 0;}
}else if(n == 1){
char tmp;
tmp = before[0];
before[0] = before[1];
before[1] = tmp;
for(i=0;before[i] != after[i];i++);
if(i==3){
ans = 0;
}else{
tmp = before[0];
before[0] = before[1];
before[1] = tmp;
tmp = before[1];
before[1] = before[2];
before[2] = tmp;
for(i=0;before[i] != after[i];i++);
if(i==3){ans=0;}
}
}else{
int ok=0, ng=0;
for(i=0;i<3;i++){
if(before[i] == 'o'){ok++;}
if(before[i] == 'x'){ng++;}
if(after[i] == 'o'){ok--;}
if(after[i] == 'x'){ng--;}
}
if(ok == 0 && ng == 0){
ans = 0;
}
}
if(ans){
printf("SUCCESS\n");
}else{
printf("FAILURE\n");
}
return 0;
}
TLwiegehtt