結果

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

テストケース

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

ソースコード

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;
                case RPS::scissors:
                    res = RPSResult::Won;
                case RPS::paper:
                    res = RPSResult::Lost;
            }
        case RPS::scissors:
            switch(yours){
                case RPS::rock:
                    res = RPSResult::Lost;
                case RPS::scissors:
                    res = RPSResult::Drew;
                case RPS::paper:
                    res = RPSResult::Won;
            }
        case RPS::paper:
            switch(yours){
                case RPS::rock:
                    res = RPSResult::Won;
                case RPS::scissors:
                    res = RPSResult::Lost;
                case RPS::paper:
                    res = RPSResult::Drew;
            }
    }
    switch(res){
        case RPSResult::Won:
            std::cout << "Won" << std::endl;
        case RPSResult::Drew:
            std::cout << "Drew" << std::endl;
        case RPSResult::Lost:
            std::cout << "Lost" << std::endl;
    }
    return 0;
}
0