結果

問題 No.455 冬の大三角
ユーザー shiccocsanshiccocsan
提出日時 2016-12-12 21:42:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,022 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-05-07 04:43:14
合計ジャッジ時間 3,476 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
11,008 KB
testcase_01 AC 31 ms
11,136 KB
testcase_02 AC 28 ms
11,136 KB
testcase_03 AC 29 ms
11,136 KB
testcase_04 RE -
testcase_05 AC 28 ms
11,008 KB
testcase_06 RE -
testcase_07 AC 28 ms
11,136 KB
testcase_08 AC 29 ms
11,008 KB
testcase_09 AC 29 ms
11,008 KB
testcase_10 RE -
testcase_11 AC 28 ms
10,880 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 28 ms
11,136 KB
testcase_15 AC 27 ms
11,136 KB
testcase_16 AC 29 ms
10,880 KB
testcase_17 AC 28 ms
11,008 KB
testcase_18 AC 29 ms
11,136 KB
testcase_19 RE -
testcase_20 AC 30 ms
10,880 KB
testcase_21 AC 29 ms
11,136 KB
testcase_22 RE -
testcase_23 AC 29 ms
11,136 KB
testcase_24 RE -
testcase_25 AC 27 ms
11,008 KB
testcase_26 AC 29 ms
11,136 KB
testcase_27 AC 29 ms
11,136 KB
testcase_28 AC 28 ms
11,008 KB
testcase_29 AC 29 ms
10,880 KB
testcase_30 AC 28 ms
11,136 KB
testcase_31 AC 29 ms
10,880 KB
testcase_32 AC 28 ms
11,008 KB
testcase_33 AC 30 ms
11,008 KB
testcase_34 AC 29 ms
11,008 KB
testcase_35 AC 29 ms
11,008 KB
testcase_36 AC 30 ms
10,880 KB
testcase_37 AC 28 ms
11,008 KB
testcase_38 AC 28 ms
11,008 KB
testcase_39 AC 29 ms
11,136 KB
testcase_40 AC 30 ms
11,136 KB
testcase_41 AC 29 ms
11,008 KB
testcase_42 AC 30 ms
11,008 KB
testcase_43 AC 30 ms
10,880 KB
testcase_44 AC 29 ms
11,136 KB
testcase_45 AC 29 ms
11,136 KB
testcase_46 AC 28 ms
11,136 KB
testcase_47 AC 28 ms
11,008 KB
testcase_48 AC 29 ms
11,008 KB
testcase_49 AC 27 ms
11,008 KB
testcase_50 AC 28 ms
11,008 KB
testcase_51 AC 28 ms
11,136 KB
testcase_52 AC 27 ms
11,136 KB
testcase_53 AC 28 ms
11,136 KB
testcase_54 AC 29 ms
11,136 KB
testcase_55 AC 28 ms
11,008 KB
testcase_56 AC 29 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import random

m = 10 ** (-10)


def eq(a, b):
    return a - m <= b <= a + m


def p(stars, b):
    x1 = stars[0][0] - b[0]
    x2 = stars[1][0] - b[0]
    y1 = stars[0][1] - b[1]
    y2 = stars[1][1] - b[1]
    if (x1 == 0 and x2 == 0) or (y1 == 0 and y2 == 0):
        return True

    if x2 == 0:
        x1, x2 = x2, x1
        y1, y2 = y2, y1
    if y2 == 0:
        return False
    return eq(x1 / x2, y1 / y2)


def run():
    H, W = list(map(int, input().split()))
    stars = []
    for i in range(H):
        f = input().find('*')
        if f >= 0:
            stars.append((i, f))

    while 1:
        star3 = (random.randint(0, H - 1), random.randint(0, W - 1))
        if star3 not in stars and not p(stars, star3):
            stars.append(star3)
            break

    for i in range(H):
        row = '-' * W
        for a in [s for s in stars if s[0] == i]:
            row = row[:a[1]] + '*' + (row[a[1] + 1:] if a[1] < W - 1 else '')

        print(row)


run()
# print(p(((0, 1), (1, 4)), (3, 10)))
0