結果
| 問題 |
No.491 10^9+1と回文
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-12 16:30:25 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 1,000 ms |
| コード長 | 392 bytes |
| コンパイル時間 | 828 ms |
| コンパイル使用メモリ | 104,680 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 23:02:20 |
| 合計ジャッジ時間 | 3,384 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 103 |
ソースコード
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);
}