結果
| 問題 | No.491 10^9+1と回文 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-12 16:30:25 |
| 言語 | D (dmd 2.113.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 31 ms / 1,000 ms |
| + 635µs | |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 86,792 KB |
| 実行使用メモリ | 9,904 KB |
| 最終ジャッジ日時 | 2026-10-19 13:02:16 |
| 合計ジャッジ時間 | 5,393 ms |
|
ジャッジサーバーID (参考情報) |
judge6_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 105 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main()
{
auto n = readln.chomp.to!long, k = (n/(10^^9+1)).to!int;
auto s = k.to!string, ns = s.length, sh = 10^^((ns+1)/2), r = 0;
foreach (i; 1..sh) {
auto t = i.to!string, nt = t.length;
if (chain(t, t.retro).to!long <= k) ++r;
if (chain(t, t[0..$-1].retro).to!long <= k) ++r;
}
writeln(r);
}