結果

問題 No.438 Cwwプログラミング入門
ユーザー finefine
提出日時 2016-10-28 23:57:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,507 bytes
コンパイル時間 1,665 ms
コンパイル使用メモリ 169,308 KB
実行使用メモリ 501,932 KB
最終ジャッジ日時 2024-05-03 18:05:13
合計ジャッジ時間 10,352 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

int extgcd(int a, int b, int &x, int &y) {
    int d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    int x, y;
    int d = extgcd(a, b, x, y);
    string s = "";
    if (c % d != 0) s = "mourennaihasimasenn";
    else {
        x *= c / d;
        y *= c / d;
        if (x + y > 5000) s = "mourennaihasimasenn";
        else {
            if (x < 0) {
                x = -x;
                for (int i = 0; i < y; i++) s += "w";
                for (int i = 0; i < y - 1; i++) s += "C";
                for (int i = 0; i < x; i++) s += "c";
                for (int i = 0; i < x - 1; i++) s += "C";
                s += "W";
            } else {
                for (int i = 0; i < x; i++) s += "c";
                for (int i = 0; i < x - 1; i++) s += "C";
                if (y < 0) {
                    y = -y;
                    for (int i = 0; i < y; i++) s += "w";
                    for (int i = 0; i < y - 1; i++) s += "C";
                    s += "W";
                } else {
                    for (int i = 0; i < y; i++) s += "w";
                    for (int i = 0; i < y - 1; i++) s += "C";
                    if (x != 0 && y != 0) s += "C";
                }
            }
        }
    }
    cout << s << endl;
    return 0;
}
0