結果

問題 No.491 10^9+1と回文
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2018-08-21 00:40:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,470 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 82,196 KB
実行使用メモリ 8,016 KB
最終ジャッジ日時 2023-08-18 15:56:55
合計ジャッジ時間 9,560 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
7,796 KB
testcase_01 AC 45 ms
7,664 KB
testcase_02 AC 45 ms
7,792 KB
testcase_03 AC 43 ms
7,780 KB
testcase_04 AC 44 ms
7,720 KB
testcase_05 AC 47 ms
7,608 KB
testcase_06 AC 46 ms
7,548 KB
testcase_07 AC 43 ms
7,628 KB
testcase_08 AC 43 ms
7,680 KB
testcase_09 AC 45 ms
7,940 KB
testcase_10 AC 46 ms
7,548 KB
testcase_11 AC 47 ms
7,772 KB
testcase_12 AC 45 ms
7,640 KB
testcase_13 AC 44 ms
7,600 KB
testcase_14 AC 45 ms
7,552 KB
testcase_15 AC 45 ms
7,756 KB
testcase_16 AC 45 ms
7,612 KB
testcase_17 AC 44 ms
7,548 KB
testcase_18 AC 45 ms
7,720 KB
testcase_19 AC 45 ms
7,904 KB
testcase_20 AC 45 ms
7,832 KB
testcase_21 AC 44 ms
7,940 KB
testcase_22 AC 43 ms
7,828 KB
testcase_23 AC 44 ms
7,744 KB
testcase_24 AC 45 ms
7,624 KB
testcase_25 AC 44 ms
7,944 KB
testcase_26 AC 46 ms
7,584 KB
testcase_27 AC 44 ms
7,684 KB
testcase_28 AC 44 ms
7,600 KB
testcase_29 AC 44 ms
7,780 KB
testcase_30 AC 44 ms
7,584 KB
testcase_31 AC 43 ms
7,596 KB
testcase_32 AC 42 ms
7,908 KB
testcase_33 AC 43 ms
7,788 KB
testcase_34 AC 44 ms
7,576 KB
testcase_35 AC 44 ms
7,548 KB
testcase_36 AC 44 ms
7,736 KB
testcase_37 AC 45 ms
7,584 KB
testcase_38 AC 45 ms
7,580 KB
testcase_39 AC 44 ms
7,744 KB
testcase_40 AC 45 ms
7,744 KB
testcase_41 AC 45 ms
7,624 KB
testcase_42 AC 43 ms
7,576 KB
testcase_43 AC 44 ms
7,664 KB
testcase_44 AC 44 ms
7,640 KB
testcase_45 AC 45 ms
7,620 KB
testcase_46 AC 44 ms
7,552 KB
testcase_47 AC 44 ms
7,612 KB
testcase_48 AC 44 ms
7,736 KB
testcase_49 AC 45 ms
7,612 KB
testcase_50 AC 43 ms
7,724 KB
testcase_51 AC 44 ms
7,928 KB
testcase_52 AC 45 ms
7,604 KB
testcase_53 AC 44 ms
7,600 KB
testcase_54 AC 44 ms
7,640 KB
testcase_55 AC 43 ms
7,576 KB
testcase_56 AC 44 ms
7,664 KB
testcase_57 AC 46 ms
7,648 KB
testcase_58 AC 44 ms
7,776 KB
testcase_59 AC 43 ms
7,720 KB
testcase_60 AC 44 ms
7,684 KB
testcase_61 AC 45 ms
7,576 KB
testcase_62 AC 45 ms
7,740 KB
testcase_63 AC 45 ms
7,756 KB
testcase_64 AC 45 ms
7,724 KB
testcase_65 AC 45 ms
7,600 KB
testcase_66 AC 45 ms
7,552 KB
testcase_67 AC 44 ms
7,740 KB
testcase_68 AC 44 ms
7,716 KB
testcase_69 AC 46 ms
7,680 KB
testcase_70 AC 48 ms
7,704 KB
testcase_71 AC 45 ms
7,708 KB
testcase_72 AC 45 ms
7,684 KB
testcase_73 AC 46 ms
7,544 KB
testcase_74 AC 44 ms
7,940 KB
testcase_75 AC 45 ms
7,744 KB
testcase_76 AC 46 ms
7,580 KB
testcase_77 AC 44 ms
7,912 KB
testcase_78 AC 45 ms
7,660 KB
testcase_79 AC 45 ms
7,780 KB
testcase_80 AC 45 ms
7,584 KB
testcase_81 AC 46 ms
7,608 KB
testcase_82 AC 46 ms
7,684 KB
testcase_83 AC 45 ms
7,596 KB
testcase_84 AC 45 ms
7,688 KB
testcase_85 AC 44 ms
7,640 KB
testcase_86 AC 44 ms
7,552 KB
testcase_87 AC 44 ms
7,576 KB
testcase_88 AC 44 ms
7,608 KB
testcase_89 AC 44 ms
7,676 KB
testcase_90 AC 45 ms
7,552 KB
testcase_91 AC 45 ms
7,664 KB
testcase_92 AC 45 ms
7,680 KB
testcase_93 AC 45 ms
7,776 KB
testcase_94 AC 46 ms
7,940 KB
testcase_95 AC 46 ms
7,644 KB
testcase_96 AC 46 ms
7,904 KB
testcase_97 AC 44 ms
7,608 KB
testcase_98 AC 45 ms
7,704 KB
testcase_99 AC 45 ms
7,548 KB
testcase_100 WA -
testcase_101 AC 45 ms
7,680 KB
testcase_102 AC 44 ms
7,580 KB
testcase_103 AC 44 ms
7,640 KB
testcase_104 WA -
testcase_105 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};


bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  ll N,sin;
  cin >> N;
  sin = N / (10E8+1);
  vector<vector<ll> > kaibun(12,vector<ll>(0));
  vector<ll> kaib(0);
  for(int i=0;i<=9;i++){
    kaibun[1].push_back(i);
    kaib.push_back(i);
  }
  for(int i=0;i<=9;i++){
    kaibun[2].push_back(i*11);
    kaib.push_back(i*11);
  }
  for(int i=3;i<=10;i++){
    for(int j=0;j<kaibun[i-2].size();j++){
      for(int k=1;k<=9;k++){
        kaibun[i].push_back(k*pow(10,i-1)+10*kaibun[i-2][j]+k);
        kaib.push_back(k*pow(10,i-1)+10*kaibun[i-2][j]+k);
      }
    }
    REP(k,kaibun[i-2].size()){
      kaibun[i].push_back(10*kaibun[i-2][k]);
    }
  }
  sort(kaib.begin(),kaib.end());
  
  kaib.erase(kaib.begin());
  kaib.erase(kaib.begin());
  cout << abs(kaib.begin()-upper_bound(kaib.begin(),kaib.end(),sin)) << endl;
  return 0;
}

0