結果

問題 No.438 Cwwプログラミング入門
ユーザー crazybbb3crazybbb3
提出日時 2016-10-29 13:28:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 3,505 bytes
コンパイル時間 2,396 ms
コンパイル使用メモリ 79,736 KB
実行使用メモリ 54,120 KB
最終ジャッジ日時 2024-05-03 19:26:17
合計ジャッジ時間 20,111 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
37,380 KB
testcase_01 WA -
testcase_02 AC 53 ms
36,780 KB
testcase_03 AC 52 ms
37,212 KB
testcase_04 AC 52 ms
37,292 KB
testcase_05 AC 53 ms
37,152 KB
testcase_06 AC 52 ms
36,616 KB
testcase_07 AC 53 ms
36,984 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 53 ms
36,908 KB
testcase_14 WA -
testcase_15 AC 52 ms
37,212 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 52 ms
37,076 KB
testcase_19 AC 55 ms
37,344 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 52 ms
37,256 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 53 ms
36,936 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 54 ms
37,128 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 53 ms
37,024 KB
testcase_39 WA -
testcase_40 AC 53 ms
37,204 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 52 ms
37,348 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 51 ms
37,112 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 53 ms
36,924 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 53 ms
37,384 KB
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 52 ms
37,108 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 AC 53 ms
36,932 KB
testcase_66 WA -
testcase_67 AC 52 ms
37,208 KB
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 AC 53 ms
36,928 KB
testcase_79 AC 55 ms
36,908 KB
testcase_80 AC 52 ms
37,244 KB
testcase_81 AC 54 ms
36,780 KB
testcase_82 AC 52 ms
37,116 KB
testcase_83 AC 53 ms
37,204 KB
testcase_84 AC 53 ms
37,352 KB
testcase_85 AC 53 ms
37,032 KB
testcase_86 AC 52 ms
36,764 KB
testcase_87 AC 52 ms
37,212 KB
testcase_88 RE -
testcase_89 WA -
testcase_90 AC 53 ms
37,384 KB
testcase_91 RE -
testcase_92 RE -
testcase_93 RE -
testcase_94 RE -
testcase_95 WA -
testcase_96 WA -
testcase_97 WA -
testcase_98 AC 53 ms
37,208 KB
testcase_99 AC 53 ms
37,204 KB
testcase_100 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int x = ni();
        int y = ni();
        int z = ni();

        for (int i = 0; i <= 4999; i++) {
            if ((z - x * i) % y == 0) {
                int t = (z - x * i) / y;
                if (t >= -4998 && t <= 4999) {
                    output(i, t);
                    return;
                }
            }
            if ((z - x * (-i)) % y == 0) {
                int t = (z - x * (-i)) / y;
                if (t >= -4998 && t <= 4999) {
                    output(-i, t);
                    return;
                }
            }
        }

        out.println("mourennaihasimasenn");
    }

    void output(int x, int y) {
        String ans = "";
        if (x < 0) {
            for (int i = 0; i < y; i++) {
                if (i == 0) ans += "w";
                else ans += "wC";
            }
            for (int i = 0; i < x; i++) {
                ans += "cW";
            }
        } else if (y < 0) {
            for (int i = 0; i < x; i++) {
                if (i == 0) ans += "c";
                else ans += "cC";
            }
            for (int i = 0; i < x; i++) {
                ans += "wW";
            }
        } else {
            for (int i = 0; i < y; i++) {
                if (i == 0) ans+="c";
                else ans+="cC";
            }
            for (int i = 0; i < x; i++) {
                if ("".equals(ans)) ans += "w";
                ans+="wC";
            }
        }
        out.println(ans);
    }

    int gcd(int a, int b) {
        return a == 0 ? b : gcd(b % a, a);
    }

    int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }

    int[] extgcd(int a, int b, int[] is) {
        if (a == 0) {
            is[0] = 0;
            is[1] = 1;
            is[2] = b;
        } else {
            extgcd(b % a, a, is);
            int x = is[1] - b / a * is[0];
            is[1] = is[0];
            is[0] = x;
        }
        return is;
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0