結果

問題 No.413 +5,000,000pts
ユーザー startcppstartcpp
提出日時 2016-08-13 00:19:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 151 ms / 5,000 ms
コード長 637 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 59,648 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-07 12:08:04
合計ジャッジ時間 1,106 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>
#define ll long long
using namespace std;

//t^2 >= 1 + 4dを満たす最大のdを返す
ll getD(ll t) {
	return (t * t - 2) / 4;
}

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

ll right(ll d) {
	ll st = 0, ed = 1145141919, mid;	//oooxxx, [st, ed)
	while (ed - st > 1) {
		mid = (st + ed) / 2;
		if (mid * mid + mid <= d) st = mid;
		else ed = mid;
	}
	return st;
}

int main() {
	ll t, d;
	ll cnt = 0;
	
	for (t = 600000000; t < 700000000; t++) {
		d = getD(t);
		if (right(d) != calc(d)) {
			cout << d << endl;
			cnt++;
		}
		if (cnt == 100000) {
			break;
		}
	}
	return 0;
}
0