結果
| 問題 | 
                            No.197 手品
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-07-04 10:43:34 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,020 bytes | 
| コンパイル時間 | 99 ms | 
| コンパイル使用メモリ | 21,120 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-27 13:33:21 | 
| 合計ジャッジ時間 | 1,239 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 41 WA * 2 | 
コンパイルメッセージ
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[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;
}