結果

問題 No.8054 ほぼ直角二等辺三角形
ユーザー kyort0nkyort0n
提出日時 2019-04-01 23:22:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,301 bytes
コンパイル時間 1,777 ms
コンパイル使用メモリ 169,356 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 04:31:07
合計ジャッジ時間 2,659 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
typedef __int128 Lint;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<Lint> c;
    c.push_back(-1);
    c.push_back(5);
    c.push_back(29);
    c.push_back(169);
    c.push_back(5741);
    c.push_back(33461);
    c.push_back(195025);
    c.push_back(1136689);
    c.push_back(38613965);
    c.push_back(225058681);
    c.push_back(1311738121);
    c.push_back(44560482149);
    c.push_back(259717522849);
    c.push_back(1513744654945);
    c.push_back(51422757785981);
    c.push_back(299713796309065);
    c.push_back(1746860020068409);
    c.push_back(59341817924539925);
    c.push_back(345869461223138161);
    //for(int i = 0; i < c.size(); i++) cout << c[i] << endl;
    Lint C = c[N];
    Lint ok = 0;
    Lint ng = 1000000000000000000;
    while(ng - ok > 1) {
        Lint mid = (ok + ng) / 2;
        if(2 * mid * mid + 2 * mid + 1 <= C * C) ok = mid;
        else ng = mid;
    }
    cout << (long long)ok << " " << (long long)ok + 1 << " " << (long long)C << endl;
    return 0;
}
0