結果

問題 No.3098 tan 2
ユーザー AsahiAsahi
提出日時 2023-03-31 21:26:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 1,101 bytes
コンパイル時間 2,926 ms
コンパイル使用メモリ 78,704 KB
実行使用メモリ 40,932 KB
最終ジャッジ日時 2023-10-24 07:12:17
合計ジャッジ時間 5,256 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
40,768 KB
testcase_01 AC 106 ms
40,620 KB
testcase_02 AC 113 ms
40,932 KB
testcase_03 AC 110 ms
40,680 KB
testcase_04 AC 107 ms
40,236 KB
testcase_05 AC 105 ms
40,256 KB
testcase_06 AC 112 ms
40,928 KB
testcase_07 AC 102 ms
39,712 KB
testcase_08 AC 112 ms
40,696 KB
testcase_09 AC 114 ms
40,684 KB
testcase_10 AC 113 ms
40,688 KB
testcase_11 AC 113 ms
40,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
    }

}

0