結果
問題 | No.491 10^9+1と回文 |
ユーザー |
|
提出日時 | 2020-06-05 15:01:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 2,029 ms |
コンパイル使用メモリ | 197,032 KB |
最終ジャッジ日時 | 2025-01-10 21:35:26 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 WA * 61 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);i++)using namespace std;using lint=long long;int main(){lint n; cin>>n;lint ans=0;for(lint a=1;a<=100000;a++){string s=to_string(a);string t=s;reverse(t.begin(),t.end());lint x=stoll(t+s);if(x%10!=0 && x<lint(1e9) && lint(1e9+1)*x<=n) ans++;}for(lint a=1;a<=100000;a++){string s=to_string(a);string t=s.substr(1);reverse(t.begin(),t.end());lint x=stoll(t+s);if(x%10!=0 && x<lint(1e9) && lint(1e9+1)*x<=n) ans++;}cout<<ans<<'\n';return 0;}