結果
問題 | No.491 10^9+1と回文 |
ユーザー | aaaaaaiu |
提出日時 | 2019-08-28 00:13:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 1,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 1,969 ms |
コンパイル使用メモリ | 195,356 KB |
最終ジャッジ日時 | 2025-01-07 15:24:23 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 103 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin>>n; n/=1000000001; int ans=0; for (int i=1;i<100000;i++) { string s=to_string(i); int len=s.size(); string t=s; for (int j=len-1;j>=0;j--) t+=s[j]; if (stoll(t)<=n) ans++; t=s; for (int j=len-2;j>=0;j--) t+=s[j]; if (stoll(t)<=n) ans++; } cout<<ans<<endl; return 0; }