結果

問題 No.491 10^9+1と回文
ユーザー albicilla
提出日時 2017-03-10 23:23:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 1,269 ms
コンパイル使用メモリ 160,416 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 08:42:07
合計ジャッジ時間 3,612 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 87
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) begin(v), end(v)
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,b) FOR(i,0,b)

const ll mod = 1e9+7;
ll INF = 1000;

ll n,k,a[100010],b[100010],ans;
string s;
int main(){
  cin>>n;
  s=to_string(n);
  //cout<<s<<endl;
  int top=s[0]-'0';
  int bottom=s[s.size()-1]-'0';
  int keta=s.size();
  if(s.size()<9){
    cout<<0<<endl;
    return 0;
  }

  keta-=9;
  rep(i,keta-1)ans+=9;

  if(top>1)ans+=top-1;
  else{
    if(n>1000000001)ans++;
  }

  cout<<ans<<endl;
  return 0;
}

0