結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー TiramisterTiramister
提出日時 2019-04-01 23:18:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,897 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 67,384 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 02:27:33
合計ジャッジ時間 1,926 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>

using lint = long long;

template <class T>
inline T sq(T a) { return a * a; }

int main() {
    /*
    lint N;
    std::cin >> N;
    for(lint n = 1; n <= N; ++n) {
        lint q = sq(n) * 2 +- 1;
        lint fq = std::round(std::sqrt(q));
        if (fq * fq == q) {
            lint m = fq + n;
            std::cout << std::make_pair(n, m)  << std::endl;
            lint a = sq(m) - sq(n);
            lint b = 2 * m * n;
            lint c = sq(m) + sq(n);
            std::cout << "->(" << a << "," << b << "," << c << ")" << std::endl;
        }
    }
    */

    const lint a[19] = {
        0,
        3,
        20,
        119,
        4059,
        23660,
        137903,
        4684659,
        27304196,
        159140519,
        5406093003LL,
        31509019100LL,
        183648021599LL,
        6238626641379LL,
        36361380737780LL,
        211929657785303LL,
        1235216565974040LL,
        41961001862379596LL,
        244566641436218639LL,
    };

    const lint c[19] = {
        0,
        5,
        29,
        169,
        5741,
        33461,
        195025,
        6625109,
        38613965,
        225058681,
        7645370045LL,
        44560482149LL,
        259717522849LL,
        8822750406821LL,
        51422757785981LL,
        299713796309065LL,
        1746860020068409LL,
        59341817924539925LL,
        345869461223138161LL,
    };

    int N;
    std::cin >> N;
    std::cout << a[N] << " " << a[N] + 1 << " " << c[N] << std::endl;
    return 0;
}

/*
01 (3,                   4,                   5)
02 (20,                  21,                  29)
03 (119,                 120,                 169)
04 (4059,                4060,                5741)
05 (23660,               23661,               33461)
06 (137903,              137904,              195025)
07 (803760,              803761,              1136689)
07 (4684659,             4684660,             6625109)
08 (27304196,            27304197,            38613965)
09 (159140519,           159140520,           225058681)
10 (927538920,           927538921,           1311738121)
10 (5406093003,          5406093004,          7645370045)
11 (31509019100,         31509019101,         44560482149)
12 (183648021599,        183648021600,        259717522849)
13 (1070379110496,       1070379110497,       1513744654945)
13 (6238626641379,       6238626641380,       8822750406821)
14 (36361380737780,      36361380737781,      51422757785981)
15 (211929657785303,     211929657785304,     299713796309065)
16 (1235216565974040,    1235216565974041,    1746860020068409)
17 (7199369738058939,    7199369738058940,    10181446324101389)
17 (41961001862379596,   41961001862379597,   59341817924539925)
18 (244566641436218639,  244566641436218640,  345869461223138161)
19 (1425438846754932240, 1425438846754932241, 2015874949414289041)
*/
0