結果

問題 No.197 手品
コンテスト
ユーザー taro305
提出日時 2016-07-04 10:00:35
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 964 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 485 ms
コンパイル使用メモリ 39,680 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-15 11:12:26
合計ジャッジ時間 1,881 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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;
}
0