結果

問題 No.491 10^9+1と回文
ユーザー vjudge1
提出日時 2025-05-21 15:25:48
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 163 ms / 1,000 ms
コード長 921 bytes
コンパイル時間 3,251 ms
コンパイル使用メモリ 273,668 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-05-21 15:25:56
合計ジャッジ時間 7,689 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 103
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int c=1e9+1,B=1e7;
int n,ans,t[105]={0,10998,11998,12998,13998,14998,15998,16998,17998,18998,19998,20998,21998,22998,23998,24998,25998,26998,27998,28998,29998,30998,31998,32998,33998,34998,35998,36998,37998,38998,39998,40998,41998,42998,43998,44998,45998,46998,47998,48998,49998,50998,51998,52998,53998,54998,55998,56998,57998,58998,59998,60998,61998,62998,63998,64998,65998,66998,67998,68998,69998,70998,71998,72998,73998,74998,75998,76998,77998,78998,79998,80998,81998,82998,83998,84998,85998,86998,87998,88998,89998,90998,91998,92998,93998,94998,95998,96998,97998,98998,99998,100998,101998,102998,103998,104998,105998,106998,107998,108998,109998};
bool check(int n)
{
	int tmp=n,m=0;
	while(tmp)
	{
		m=m*10+tmp%10;
		tmp/=10;
	}
	return n==m;
}
signed main()
{
	cin>>n;n/=c;ans=t[n/B];
	for(int i=1;i<=n%B;i++)ans+=check(n/B*B+i);
	cout<<ans;
}
0