結果

問題 No.438 Cwwプログラミング入門
ユーザー face4face4
提出日時 2019-02-12 11:54:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,329 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 66,088 KB
実行使用メモリ 5,312 KB
最終ジャッジ日時 2023-10-11 10:24:06
合計ジャッジ時間 9,864 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,352 KB
testcase_15 WA -
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,356 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,352 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,352 KB
testcase_29 AC 2 ms
4,352 KB
testcase_30 WA -
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,352 KB
testcase_35 AC 2 ms
4,352 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,352 KB
testcase_38 WA -
testcase_39 AC 2 ms
4,348 KB
testcase_40 WA -
testcase_41 AC 2 ms
4,352 KB
testcase_42 AC 2 ms
4,352 KB
testcase_43 AC 1 ms
4,352 KB
testcase_44 AC 2 ms
4,372 KB
testcase_45 AC 2 ms
4,356 KB
testcase_46 AC 2 ms
4,352 KB
testcase_47 AC 2 ms
4,348 KB
testcase_48 AC 2 ms
4,352 KB
testcase_49 AC 2 ms
4,352 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 2 ms
4,348 KB
testcase_53 AC 2 ms
4,352 KB
testcase_54 WA -
testcase_55 AC 2 ms
4,352 KB
testcase_56 AC 2 ms
4,352 KB
testcase_57 AC 2 ms
4,352 KB
testcase_58 WA -
testcase_59 AC 2 ms
4,352 KB
testcase_60 AC 2 ms
4,352 KB
testcase_61 AC 2 ms
4,352 KB
testcase_62 WA -
testcase_63 AC 1 ms
4,352 KB
testcase_64 AC 2 ms
4,348 KB
testcase_65 WA -
testcase_66 AC 2 ms
4,352 KB
testcase_67 WA -
testcase_68 WA -
testcase_69 AC 1 ms
4,352 KB
testcase_70 AC 2 ms
4,348 KB
testcase_71 AC 1 ms
4,348 KB
testcase_72 AC 2 ms
4,348 KB
testcase_73 AC 2 ms
4,352 KB
testcase_74 AC 1 ms
4,372 KB
testcase_75 AC 2 ms
4,352 KB
testcase_76 WA -
testcase_77 AC 1 ms
4,348 KB
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 WA -
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 AC 2 ms
4,352 KB
testcase_89 AC 2 ms
4,352 KB
testcase_90 AC 2 ms
4,352 KB
testcase_91 AC 2 ms
4,376 KB
testcase_92 AC 1 ms
4,348 KB
testcase_93 AC 1 ms
4,352 KB
testcase_94 RE -
testcase_95 WA -
testcase_96 WA -
testcase_97 AC 2 ms
4,352 KB
testcase_98 WA -
testcase_99 WA -
testcase_100 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
typedef long long ll;

void answer(ll a, ll b){
    int add = 0, sub = 0;
    if(a < 0){
        for(int i = 0; i < abs(a); i++) cout << "c";
        sub += (int)abs(a);
    }
    if(b < 0){
        for(int i = 0; i < abs(b); i++) cout << "w";
        sub += (int)abs(b);
    }
    if(a > 0){
        for(int i = 0; i < abs(a); i++) cout << "c";
        add += (int)abs(a)-1;
    }
    if(b > 0){
        for(int i = 0; i < abs(b); i++) cout << "w";
        add += (int)abs(b)-1;
    }
    while(add-- > 0)    cout << "C";
    while(sub-- > 0)    cout << "W";
    cout << endl;
}

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    if(x == 0 || y == 0){
        if(z == 0)  cout << "ccW" << endl;
        else{
            if(z%(max(x,y)) > 0 || z/(max(x,y)) > 5000)  cout << "NO" << endl;
            else{
                char c = x > y ? 'c' : 'w';
                for(int i = 0; i < z/max(x,y); i++)    cout << c;
                for(int i = 1; i < z/max(x,y); i++)    cout << "C";
                cout << endl;
            }
        }
        return 0;
    }

    for(ll a = -5000; a <= 5000; a++){
        if(abs(z-a*x)%y)   continue;
        if(2*abs(a) + 2*(abs(z-a*x)/y) - 1 <= 10000){
            answer(a, (z-a*x)/y);
            return 0;
        }
    }

    return 0;
}
0