結果
| 問題 | No.413 +5,000,000pts |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-08 09:00:19 |
| 言語 | C++11(old_compat) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 5,000 ms |
| コード長 | 560 bytes |
| 記録 | |
| コンパイル時間 | 1,373 ms |
| コンパイル使用メモリ | 167,100 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:06:29 |
| 合計ジャッジ時間 | 1,335 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
using i64 = long long;
i64 calc(i64 d) {
return i64((-1 + sqrt(1 + 4*d)) / 2.0);
}
bool is_correct(i64 t, i64 d) {
return t*t + t <= d && d < (t+1)*(t+1) + (t+1);
}
int main(void) {
const i64 MAX_VALUE = i64(pow(10, 18));
const int N = 100000;
for(i64 k=i64(sqrt(MAX_VALUE)), cnt=0; cnt<N; --k) {
for(i64 d=k*k+k-1; cnt<N; ++cnt, --d) {
if(!(1 <= d && d <= MAX_VALUE)) { break; }
if(is_correct(calc(d), d)) { break; }
printf("%lld\n", d);
}
}
return 0;
}