結果

問題 No.413 +5,000,000pts
ユーザー kimiyukikimiyuki
提出日時 2016-10-07 20:01:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 68,352 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-05-01 15:02:37
合計ジャッジ時間 1,228 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
5,248 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