結果

問題 No.413 +5,000,000pts
ユーザー 37zigen37zigen
提出日時 2016-06-06 22:25:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 556 ms / 5,000 ms
コード長 642 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 72,976 KB
実行使用メモリ 54,108 KB
最終ジャッジ日時 2024-04-20 07:18:14
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package yukicoder;
public class Main{
	public static void main(String[] args) {
		new Main().solve();
	}

	void solve() {
		int count = 0;
		for (long i = 1_000_000_000L; i >= 1; i--) {
			long d = i * (i + 1) - 1;
			if (d <= 1_000_000_000_000_000_000L) {
				while (!iscorrect(d)) {
					System.out.println(d);
					d--;
					count++;
					if (count == 100000)
						return;
				}
			}
		}
	}

	boolean iscorrect(long d) {
		long ans = calc(d);
		if (ans * ans + ans <= d && (ans + 1) * (ans + 1) + (ans + 1) > d) {
			return true;
		} else
			return false;
	}
	long calc(long d) {
		return (long) ((-1 + Math.sqrt(1 + 4 * d)) / 2.0);
	}
}
0