結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
noorbeh
|
| 提出日時 | 2015-04-29 00:38:08 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 971 bytes |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 21,504 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-27 08:29:21 |
| 合計ジャッジ時間 | 1,295 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 WA * 19 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s", s);
| ^~~~~~~~~~~~~~
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
main.c:10:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%s", t);
| ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main()
{
char s[4], t[4];
int i, n, a, b;
int res;
scanf("%s", s);
scanf("%d", &n);
scanf("%s", t);
a = b = 0;
for ( i = 0; i < 4; i++ ) {
a += (s[i] == 'o') << (2-i);
b += (t[i] == 'o') << (2-i);
}
switch ( a ) {
case 0:
case 7:
res = ( b != a ) ? 1 : 0;
break;
case 1:
case 4:
if ( n % 2 ) {
res = ( b != 2 ) ? 1 : 0;
} else {
res = ( !(b == 1 || b == 4) ) ? 1 : 0;
}
break;
case 3:
case 6:
if ( n % 2 ) {
res = ( b != 5 ) ? 1 : 0;
} else {
res = ( !(b == 3 || b == 6) ) ? 1 : 0;
}
break;
case 2:
if ( n % 2 ) {
res = ( !(b == 1 || b == 4) ) ? 1 : 0;
} else {
res = ( b != 2 ) ? 1 : 0;
}
break;
case 5:
if ( n % 5 ) {
res = ( !(b == 3 && b == 6) ) ? 1 : 0;
} else {
res = ( b != 5 ) ? 1 : 0;
}
}
if ( res ) {
printf("SUCCESS\n");
} else {
printf("FAILURE\n");
}
}
noorbeh