結果
| 問題 |
No.3098 Linear Reversi
|
| コンテスト | |
| ユーザー |
qwewe
|
| 提出日時 | 2025-05-14 12:58:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,662 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 82,356 KB |
| 実行使用メモリ | 54,140 KB |
| 最終ジャッジ日時 | 2025-05-14 12:59:56 |
| 合計ジャッジ時間 | 2,452 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 37 |
ソースコード
# -*- coding: utf-8 -*-
import sys
def solve():
# Read the integer I from standard input.
# The problem constraints state that I will be an integer between 1 and 89 inclusive.
# We can assume the input will be valid according to the constraints.
I = int(sys.stdin.readline())
# The problem asks whether tan(I degrees) is a rational number.
# Let theta = I degrees = I * (pi / 180) radians.
# Since I is an integer, theta is a rational multiple of pi.
# There is a known result from number theory (related to Niven's theorem) which states:
# If theta is a rational multiple of pi, then tan(theta) is rational if and only if
# tan(theta) is equal to 0, 1, or -1.
# We are given that the integer I is in the range [1, 89].
# For angles I degrees in this range (which corresponds to the first quadrant, excluding 0 and 90 degrees):
# - tan(I degrees) is always positive.
# - tan(I degrees) cannot be 0 (since I is not 0).
# - tan(I degrees) cannot be -1 (since tan is positive in the first quadrant).
# - Therefore, the only possibility for tan(I degrees) to be rational is if tan(I degrees) = 1.
# The equation tan(I degrees) = 1 holds if and only if I = 45 (within the range 1 to 89).
# So, tan(I degrees) is rational if and only if I is exactly 45.
if I == 45:
# If I is 45, tan(45 degrees) = 1, which is rational.
print("Yes")
else:
# For any other integer I between 1 and 89, tan(I degrees) is irrational.
print("No")
# Call the solve function if the script is executed directly
if __name__ == '__main__':
solve()
qwewe