結果

問題 No.3098 tan 2
ユーザー Syed Shakil Mahmud (Shajib)Syed Shakil Mahmud (Shajib)
提出日時 2023-03-31 22:19:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 68,696 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 08:23:40
合計ジャッジ時間 1,253 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    double x = n * M_PI / 180;
    int k = (int)(x / (M_PI / 2));
    while (k % 2 == 0 && k > 0) {
        x -= k * (M_PI / 2);
        k -= 2;
    }
    double t = tan(x);
    bool is_rational = false;
    for (int q = 1; q <= 100; q++) {
        int p = round(q * t);
        if (abs(p / (double)q - t) < 1e-9) {
            is_rational = true;
            break;
        }
    }
    cout << (is_rational ? "Yes" : "No") << endl;
    return 0;
}
0