結果

問題 No.199 星を描こう
ユーザー HIROPON87069639HIROPON87069639
提出日時 2016-02-21 15:25:35
言語 Python2
(2.7.18)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 1,291 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 6,728 KB
実行使用メモリ 6,588 KB
最終ジャッジ日時 2023-08-28 18:45:00
合計ジャッジ時間 1,678 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,328 KB
testcase_01 AC 11 ms
6,364 KB
testcase_02 AC 12 ms
6,420 KB
testcase_03 AC 12 ms
6,588 KB
testcase_04 AC 11 ms
6,316 KB
testcase_05 AC 12 ms
6,524 KB
testcase_06 AC 11 ms
6,512 KB
testcase_07 AC 12 ms
6,452 KB
testcase_08 AC 12 ms
6,436 KB
testcase_09 AC 12 ms
6,520 KB
testcase_10 AC 11 ms
6,420 KB
testcase_11 AC 11 ms
6,312 KB
testcase_12 AC 12 ms
6,476 KB
testcase_13 AC 11 ms
6,516 KB
testcase_14 AC 11 ms
6,380 KB
testcase_15 AC 11 ms
6,532 KB
testcase_16 AC 12 ms
6,500 KB
testcase_17 AC 12 ms
6,472 KB
testcase_18 AC 11 ms
6,380 KB
testcase_19 AC 11 ms
6,452 KB
testcase_20 AC 12 ms
6,552 KB
testcase_21 AC 11 ms
6,520 KB
testcase_22 AC 12 ms
6,520 KB
testcase_23 AC 12 ms
6,520 KB
testcase_24 AC 12 ms
6,452 KB
testcase_25 AC 12 ms
6,408 KB
testcase_26 AC 12 ms
6,432 KB
testcase_27 AC 12 ms
6,304 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]
    rot = vec1[0] * vec2[1] - vec1[1] * vec2[0]
    if rot < 0:
        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]
for i in range(0, 4):
    if sS[i] == sS[i+1]:
        print "NO"
        exit()
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