結果

問題 No.438 Cwwプログラミング入門
ユーザー nebukuro09nebukuro09
提出日時 2016-10-29 09:59:16
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,247 bytes
コンパイル時間 692 ms
コンパイル使用メモリ 91,160 KB
実行使用メモリ 813,216 KB
最終ジャッジ日時 2023-09-02 22:37:22
合計ジャッジ時間 23,057 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 313 ms
4,368 KB
testcase_03 AC 308 ms
4,368 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 310 ms
4,372 KB
testcase_07 AC 307 ms
4,368 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 310 ms
4,368 KB
testcase_14 WA -
testcase_15 AC 313 ms
4,372 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 313 ms
4,372 KB
testcase_19 AC 306 ms
4,368 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 311 ms
4,368 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 309 ms
4,372 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 308 ms
4,372 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1 ms
4,368 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 311 ms
4,372 KB
testcase_39 WA -
testcase_40 AC 307 ms
4,372 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 307 ms
4,372 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 175 ms
4,368 KB
testcase_49 AC 117 ms
4,368 KB
testcase_50 AC 306 ms
4,368 KB
testcase_51 WA -
testcase_52 AC 69 ms
4,368 KB
testcase_53 AC 143 ms
4,368 KB
testcase_54 AC 309 ms
4,368 KB
testcase_55 AC 64 ms
4,372 KB
testcase_56 AC 97 ms
4,368 KB
testcase_57 AC 142 ms
4,368 KB
testcase_58 AC 308 ms
4,372 KB
testcase_59 AC 32 ms
4,372 KB
testcase_60 AC 101 ms
4,368 KB
testcase_61 AC 8 ms
4,368 KB
testcase_62 AC 308 ms
4,372 KB
testcase_63 AC 65 ms
4,368 KB
testcase_64 AC 75 ms
4,372 KB
testcase_65 AC 306 ms
4,372 KB
testcase_66 WA -
testcase_67 AC 310 ms
4,376 KB
testcase_68 AC 1 ms
4,368 KB
testcase_69 AC 152 ms
4,372 KB
testcase_70 AC 155 ms
4,368 KB
testcase_71 AC 156 ms
4,368 KB
testcase_72 AC 152 ms
4,372 KB
testcase_73 AC 156 ms
4,368 KB
testcase_74 AC 156 ms
4,368 KB
testcase_75 AC 155 ms
4,372 KB
testcase_76 AC 1 ms
4,372 KB
testcase_77 MLE -
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 #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.math;

string encode(int a, int b, int div) {
  string code;
  if (b < 0) {
    code = ("w".replicate(abs(b)) ~ "c".replicate(abs(a)) ~
            "C".replicate(abs(a)-1) ~ "W".replicate(abs(b))).replicate(div) ~
            "C".replicate(div-1);
  } else if (a < 0) {
    code = ("c".replicate(abs(a)) ~ "w".replicate(abs(b)) ~
            "C".replicate(abs(b)-1) ~ "W".replicate(abs(a))).replicate(div) ~
            "C".replicate(div-1);
  } else {
    code = ("c".replicate(abs(a)) ~ "w".replicate(abs(b)) ~
            "C".replicate(abs(a)+abs(b)-1)).replicate(div) ~ "C".replicate(div-1);
  }
  return code;
}

void main() {
  auto input = readln().split.map!(to!int);
  int x = input[0];
  int y = input[1];
  int z = input[2];

  if (z == 0) {
    writeln("ccW");
    return;
  }

  foreach (a; iota(-5000, 5001)) {
    foreach (b; iota(-5000, 5001)) {
      int c = a*x+b*y;
      if (c > 0 && z % c == 0 && (a != 0 && b!=0))
        if ((2*abs(a)+abs(b)-1)*z/c + z/c-1 <= 10000) {
          writeln(encode(a, b, z/c));
          return;
        }
    }
  }
  writeln("mourennaihasimasenn");
}
0