結果
問題 | No.8098 tan 2 |
ユーザー |
|
提出日時 | 2023-03-31 21:26:19 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 133 ms / 2,000 ms |
コード長 | 1,101 bytes |
コンパイル時間 | 2,320 ms |
コンパイル使用メモリ | 78,008 KB |
実行使用メモリ | 41,560 KB |
最終ジャッジ日時 | 2024-09-22 23:58:01 |
合計ジャッジ時間 | 4,344 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
import java.util.*; import java.io.*; import java.math.*; class Main{ static void solve(){ int n = ni(); double rad = Math.toRadians(n); double tan = Math.tan(rad); output.print(isRational(tan)? "Yes" : "No"); } private static boolean isRational(double x) { if (Double.isNaN(x)) return false; double fraction = x % 1; return fraction == 0 || fraction == 0.5 || fraction == -0.5; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - // static int ni(){ return Integer.parseInt(sc.next()); } static long nl(){ return Long.parseLong(sc.next()); } static double nd(){ return Double.parseDouble(sc.next()); } static String ns(){ return sc.next(); } static BigInteger bi(){ return sc.nextBigInteger(); } static BigDecimal bd(){ return sc.nextBigDecimal(); } static PrintWriter output; static Scanner sc ; public static void main(String[] args){ output = new PrintWriter(System.out); sc = new Scanner(System.in); solve(); output.flush(); } }