結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー t33ft33f
提出日時 2019-04-01 23:12:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 64,128 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 08:55:07
合計ジャッジ時間 1,645 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
int main() {
    int x; cin >> x;
    long long lb = 1;
    while (--x) lb *= 10;
    unsigned long long m = 2, n = 1;
    while (m*m + n*n < lb) {
        unsigned long long m1 = 2*m+n, n1 = m;
        m = m1; n = n1;
    }
    long long a = m*m - n*n, b = 2*m*n, c = m*m + n*n;
    cout << min(a, b) << ' ' << max(a, b) << ' ' << c << endl;
}
0