結果

問題 No.232 めぐるはめぐる (2)
ユーザー machymachy
提出日時 2015-06-26 23:42:54
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,284 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 59,252 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 01:46:42
合計ジャッジ時間 2,765 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
4,376 KB
testcase_01 AC 135 ms
4,380 KB
testcase_02 AC 133 ms
4,376 KB
testcase_03 AC 132 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 96 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int T, A, B;
    cin >> T >> A >> B;
    int m = max(A, B);
    if(m > T || (T==1 && A==0 && B==0)){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
        int r = T - m;
        if(r % 2 == 1){
            if(B == 0){
                cout << "^>" << endl;
                cout << "<" << endl;
                T -= 2;
                A -= 1;
            }else if(A == 0){
                cout << "^>" << endl;
                cout << "v" << endl;
                T -= 2;
                B -= 1;
            }else{
                cout << "^" << endl;
                cout << ">" << endl;
                T -= 2;
                A -= 1;
                B -= 1;
            }
        }
        while(A > 0 || B > 0){
            if(A > 0 && B > 0){
                cout << "^>" << endl;
                T--;
                A--; B--;
            }else if(A > 0){
                cout << "^" << endl;
                T--; A--;
            }else if(B > 0){
                cout << ">" << endl;
                T--; B--;
            }
        }
        while(T > 0){
            cout << ">" << endl;
            cout << "<" << endl;
            T -= 2;
        }
    }
    return 0;
}
0