結果

問題 No.501 穴と文字列
ユーザー Takashi MakinoTakashi Makino
提出日時 2017-04-09 15:47:46
言語 Python2
(2.7.18)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 783 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 6,720 KB
実行使用メモリ 6,052 KB
最終ジャッジ日時 2023-08-21 07:15:34
合計ジャッジ時間 1,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
6,044 KB
testcase_01 AC 18 ms
5,888 KB
testcase_02 AC 11 ms
6,028 KB
testcase_03 AC 11 ms
5,948 KB
testcase_04 AC 10 ms
5,996 KB
testcase_05 AC 11 ms
5,952 KB
testcase_06 AC 10 ms
6,012 KB
testcase_07 AC 10 ms
5,932 KB
testcase_08 AC 11 ms
6,052 KB
testcase_09 AC 11 ms
5,848 KB
testcase_10 AC 11 ms
5,940 KB
testcase_11 AC 11 ms
5,992 KB
testcase_12 AC 11 ms
6,028 KB
testcase_13 AC 11 ms
6,052 KB
testcase_14 AC 11 ms
5,844 KB
testcase_15 AC 11 ms
5,992 KB
testcase_16 AC 11 ms
6,004 KB
testcase_17 AC 11 ms
5,856 KB
testcase_18 AC 16 ms
5,900 KB
testcase_19 AC 19 ms
6,032 KB
testcase_20 AC 15 ms
5,892 KB
testcase_21 AC 19 ms
6,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8

hole_0 = ("C", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "S", "T", "U", "V", "W", "X", "Y", "Z")
hole_1 = ("A", "D", "O", "P", "Q", "R")
hole_2 = ("B")

# n:文字数 d:穴の数
def read_data():
    N, D = map(int, raw_input().split())
    return N, D

def hole_check(N, D):
    ans = ""
    if N < D:
        n = N
        d = D
        for t in xrange(N):
            if 2*n > d:
                ans += hole_1[0]
            else:
                ans += hole_2[0]
            n -= 1
            d -= 1

    elif N == D:
        for t in xrange(N):
            ans += hole_1[0]
    else:
        for t in xrange(D):
            ans += hole_1[0]
        for t in xrange(N-D):
            ans += hole_0[0]

    print ans

N, D = read_data()
hole_check(N, D)
0