結果

問題 No.264 じゃんけん
ユーザー iodo_shibaiodo_shiba
提出日時 2018-08-08 12:41:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,825 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 56,792 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 06:15:36
合計ジャッジ時間 1,110 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<sstream>
#include<string>

enum class RPS{
    rock=0,
    scissors=1,
    paper=2
};
enum class RPSResult{
    Won=0,
    Drew=1,
    Lost=2
};

int main(){
    int in1,in2;
    RPS mine,yours;
    std::cin >> in1 >> in2;
    mine=static_cast<RPS>(in1);
    yours=static_cast<RPS>(in2);
    RPSResult res=RPSResult::Won;
    switch(mine){
        case RPS::rock:
            switch(yours){
                case RPS::rock:
                    res = RPSResult::Drew;
                    break;
                case RPS::scissors:
                    res = RPSResult::Won;
                    break;
                case RPS::paper:
                    res = RPSResult::Lost;
                    break;
            }
        case RPS::scissors:
            switch(yours){
                case RPS::rock:
                    res = RPSResult::Lost;
                    break;
                case RPS::scissors:
                    res = RPSResult::Drew;
                    break;
                case RPS::paper:
                    res = RPSResult::Won;
                    break;
            }
        case RPS::paper:
            switch(yours){
                case RPS::rock:
                    res = RPSResult::Won;
                    break;
                case RPS::scissors:
                    res = RPSResult::Lost;
                    break;
                case RPS::paper:
                    res = RPSResult::Drew;
                    break;
            }
    }
    switch(res){
        case RPSResult::Won:
            std::cout << "Won" << std::endl;
            break;
        case RPSResult::Drew:
            std::cout << "Drew" << std::endl;
            break;
        case RPSResult::Lost:
            std::cout << "Lost" << std::endl;
            break;
    }
    return 0;
}
0