結果

問題 No.413 +5,000,000pts
ユーザー kimiyukikimiyuki
提出日時 2016-10-07 20:01:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 109 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 67,680 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-14 01:55:09
合計ジャッジ時間 1,039 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
typedef long long ll;
using namespace std;

ll calc(ll d) {
    return (ll)((-1 + sqrt(1 + 4*d)) / 2.0);
}

ll sq(ll x) { return x * x; }
bool check(ll t, ll d) {
    return sq(t)+t <= d and sq(t+1)+(t+1) > d;
}
int main() {
    const int n = 1e5;
    ll t = 999999999;
    for (int i = 0; i < n;) {
        repeat (dd,100) {
            ll d = sq(t)+t-dd;
            if (check(calc(d), d)) continue;
            cout << d << endl;
            if (++ i >= n) break;
        }
        -- t;
    }
    return 0;
}
0