結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
|
提出日時 | 2019-01-12 11:08:56 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1,221 ms / 2,000 ms |
コード長 | 584 bytes |
コンパイル時間 | 715 ms |
コンパイル使用メモリ | 115,968 KB |
実行使用メモリ | 222,088 KB |
最終ジャッジ日時 | 2024-06-13 02:42:50 |
合計ジャッジ時間 | 8,042 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;import std.typecons, std.range, std.random, std.math, std.container;import std.numeric, std.bigint, core.bitop, core.stdc.string;void main() {auto s = readln.split.map!(to!long);auto X = s[0];auto Y = s[1];long[long] D;for (long i = 0; i * i <= Y; ++i) {for (long j = i; i * i + j * j <= Y; ++j) {D[i * i + j * j] += i == j || i == 0 ? 4 : 8;}}if (Y !in D) D[Y] = 0;D.keys.filter!(k => X <= k && k <= Y).map!(k => D[k]).reduce!max.writeln;}