結果

問題 No.199 星を描こう
ユーザー HIROPON87069639HIROPON87069639
提出日時 2016-02-21 12:24:44
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 1,234 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 7,144 KB
実行使用メモリ 6,788 KB
最終ジャッジ日時 2023-10-23 18:46:44
合計ジャッジ時間 1,797 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,768 KB
testcase_01 AC 12 ms
6,768 KB
testcase_02 AC 11 ms
6,768 KB
testcase_03 AC 11 ms
6,768 KB
testcase_04 AC 11 ms
6,768 KB
testcase_05 AC 11 ms
6,768 KB
testcase_06 AC 12 ms
6,768 KB
testcase_07 AC 11 ms
6,768 KB
testcase_08 AC 11 ms
6,768 KB
testcase_09 AC 11 ms
6,768 KB
testcase_10 AC 11 ms
6,768 KB
testcase_11 AC 11 ms
6,768 KB
testcase_12 AC 11 ms
6,768 KB
testcase_13 AC 10 ms
6,768 KB
testcase_14 AC 11 ms
6,768 KB
testcase_15 AC 11 ms
6,768 KB
testcase_16 AC 11 ms
6,768 KB
testcase_17 AC 11 ms
6,768 KB
testcase_18 AC 10 ms
6,768 KB
testcase_19 AC 11 ms
6,768 KB
testcase_20 AC 11 ms
6,768 KB
testcase_21 AC 11 ms
6,768 KB
testcase_22 AC 11 ms
6,768 KB
testcase_23 WA -
testcase_24 AC 11 ms
6,768 KB
testcase_25 AC 11 ms
6,768 KB
testcase_26 AC 11 ms
6,768 KB
testcase_27 AC 11 ms
6,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import math


def sita(X1, Y1):
    if X1 == 0 and Y1 == 0:
        return 0
    else:
        R = (X1 ** 2 + Y1 ** 2) ** 0.5
        if Y1 > 0:
         S = math.acos(X1 / R)
        elif Y1 < 0:
         S = 2 * math.pi - math.acos(X1 / R)
        elif Y1 == 0 and X1 > 0:
         S = 0.0
        elif Y1 == 0 and X1 < 0:
         S = math.pi
        return S


def ch(X1, Y1, X2, Y2, X3, Y3):
    vec1 = [X2 - X1, Y2 - Y1]
    vec2 = [X3 - X1, Y3 - Y1]
    sit1 = sita(vec1[0], vec1[1])
    sit2 = sita(vec2[0], vec2[1])
    if sit2 < sit1:
        return 1
    else:
        return 0


X = [0.0] * 5
Y = [0.0] * 5
S = [0.0] * 5
sX = [0.0] * 7
sY = [0.0] * 7
sS = [0.0] * 5
for i in range(0, 5):
    X[i], Y[i] = map(int, raw_input().split())
cntX = sum(X)/5.0
cntY= sum(Y)/5.0
for i in range(0, 5):
    X[i] -= cntX
    Y[i] -= cntY
    S[i] = sita(X[i], Y[i])
sS = sorted(S)
for i in range(0, 5):
    for j in range(0, 5):
        if S[i] == sS[j]:
            sX[j] = X[i]
            sY[j] = Y[i]
sX[5] = sX[0]
sY[5] = sY[0]
sX[6] = sX[1]
sY[6] = sY[1]
point = 0
for i in range(0, 5):
    point += ch(sX[i], sY[i], sX[i+2], sY[i+2], sX[i+1], sY[i+1])
if point == 5:
    print "YES"
else:
    print "NO"
0