結果

問題 No.491 10^9+1と回文
ユーザー nanae
提出日時 2017-03-10 22:45:11
言語 D
(dmd 2.109.1)
結果
TLE  
実行時間 -
コード長 688 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 116,992 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-12 07:18:35
合計ジャッジ時間 3,882 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 102
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

void main(){
    auto N = readln.chomp.to!ulong;
    ulong a = 10^^9 + 1;
    ulong k = 1;
    int cnt;

    while(k*a <= N){
        if(k.to!string == k.to!(char[]).reverse.to!string){
            ++cnt;
        }
        ++k;
    }

    writeln(cnt);
}


void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}
0