結果

問題 No.197 手品
ユーザー
提出日時 2015-12-12 07:52:06
言語 Perl
(5.38.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 719 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 4,776 KB
最終ジャッジ日時 2023-09-27 09:36:40
合計ジャッジ時間 1,913 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,696 KB
testcase_01 AC 2 ms
4,640 KB
testcase_02 AC 3 ms
4,476 KB
testcase_03 AC 2 ms
4,472 KB
testcase_04 AC 2 ms
4,572 KB
testcase_05 AC 2 ms
4,764 KB
testcase_06 AC 3 ms
4,568 KB
testcase_07 AC 3 ms
4,632 KB
testcase_08 AC 3 ms
4,576 KB
testcase_09 AC 2 ms
4,496 KB
testcase_10 AC 2 ms
4,628 KB
testcase_11 AC 2 ms
4,540 KB
testcase_12 AC 3 ms
4,620 KB
testcase_13 AC 2 ms
4,592 KB
testcase_14 AC 2 ms
4,500 KB
testcase_15 AC 2 ms
4,768 KB
testcase_16 AC 2 ms
4,476 KB
testcase_17 AC 2 ms
4,516 KB
testcase_18 AC 2 ms
4,576 KB
testcase_19 AC 2 ms
4,728 KB
testcase_20 AC 3 ms
4,764 KB
testcase_21 AC 2 ms
4,680 KB
testcase_22 AC 2 ms
4,592 KB
testcase_23 AC 2 ms
4,596 KB
testcase_24 AC 2 ms
4,720 KB
testcase_25 AC 3 ms
4,676 KB
testcase_26 AC 2 ms
4,612 KB
testcase_27 AC 2 ms
4,756 KB
testcase_28 AC 3 ms
4,516 KB
testcase_29 AC 2 ms
4,568 KB
testcase_30 AC 3 ms
4,616 KB
testcase_31 AC 2 ms
4,636 KB
testcase_32 AC 3 ms
4,476 KB
testcase_33 AC 3 ms
4,596 KB
testcase_34 AC 3 ms
4,684 KB
testcase_35 AC 3 ms
4,660 KB
testcase_36 AC 3 ms
4,672 KB
testcase_37 AC 3 ms
4,672 KB
testcase_38 AC 2 ms
4,476 KB
testcase_39 AC 3 ms
4,596 KB
testcase_40 AC 2 ms
4,776 KB
testcase_41 AC 2 ms
4,596 KB
testcase_42 AC 3 ms
4,524 KB
testcase_43 AC 3 ms
4,576 KB
testcase_44 AC 2 ms
4,644 KB
testcase_45 AC 2 ms
4,504 KB
testcase_46 AC 2 ms
4,512 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

chomp(my $be = <STDIN>);
chomp(my $n = <STDIN>);
chomp(my $af = <STDIN>);

my $be_num = $be =~ s/o/o/g;
my $af_num = $af =~ s/o/o/g;

my $result;
if (not $be_num == $af_num){
    $result = "SUCCESS";
}
else {
    if ( $n == 0) {
        $result = $be ne $af ? "SUCCESS" : "FAILURE";
    }
    elsif (not $n == 1) {
        $result = "FAILURE";
    }
    else {
        my $impo = impossible($be);
        $result = $impo eq $af ? "SUCCESS" : "FAILURE";
    }
}


print "$result\n";

sub impossible {
    my $t = shift;
    return "oxo" if $t eq "oxo";
    return "xox" if $t eq "xox";
    return "oox" if $t eq "xoo";
    return "xoo" if $t eq "oox";
    return "xxo" if $t eq "oxx";
    return "oxx" if $t eq "xxo";
}
0