結果
問題 | No.491 10^9+1と回文 |
ユーザー | kmjp |
提出日時 | 2017-03-10 22:28:34 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 101 ms / 1,000 ms |
コード長 | 1,186 bytes |
コンパイル時間 | 1,316 ms |
コンパイル使用メモリ | 169,896 KB |
実行使用メモリ | 19,328 KB |
最終ジャッジ日時 | 2024-10-01 07:08:22 |
合計ジャッジ時間 | 13,123 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
19,072 KB |
testcase_01 | AC | 88 ms
19,200 KB |
testcase_02 | AC | 91 ms
19,200 KB |
testcase_03 | AC | 90 ms
19,200 KB |
testcase_04 | AC | 95 ms
19,200 KB |
testcase_05 | AC | 97 ms
19,200 KB |
testcase_06 | AC | 96 ms
19,072 KB |
testcase_07 | AC | 93 ms
19,200 KB |
testcase_08 | AC | 89 ms
19,200 KB |
testcase_09 | AC | 86 ms
19,072 KB |
testcase_10 | AC | 88 ms
19,328 KB |
testcase_11 | AC | 86 ms
19,200 KB |
testcase_12 | AC | 86 ms
19,200 KB |
testcase_13 | AC | 88 ms
19,200 KB |
testcase_14 | AC | 86 ms
19,200 KB |
testcase_15 | AC | 88 ms
19,200 KB |
testcase_16 | AC | 91 ms
19,200 KB |
testcase_17 | AC | 91 ms
19,200 KB |
testcase_18 | AC | 89 ms
19,072 KB |
testcase_19 | AC | 90 ms
19,072 KB |
testcase_20 | AC | 87 ms
19,200 KB |
testcase_21 | AC | 88 ms
19,072 KB |
testcase_22 | AC | 94 ms
19,200 KB |
testcase_23 | AC | 100 ms
19,200 KB |
testcase_24 | AC | 96 ms
19,200 KB |
testcase_25 | AC | 87 ms
19,200 KB |
testcase_26 | AC | 88 ms
19,200 KB |
testcase_27 | AC | 89 ms
19,200 KB |
testcase_28 | AC | 87 ms
19,072 KB |
testcase_29 | AC | 83 ms
19,200 KB |
testcase_30 | AC | 84 ms
19,200 KB |
testcase_31 | AC | 85 ms
19,200 KB |
testcase_32 | AC | 85 ms
19,200 KB |
testcase_33 | AC | 87 ms
19,200 KB |
testcase_34 | AC | 101 ms
19,072 KB |
testcase_35 | AC | 100 ms
19,200 KB |
testcase_36 | AC | 89 ms
19,200 KB |
testcase_37 | AC | 89 ms
19,072 KB |
testcase_38 | AC | 84 ms
19,072 KB |
testcase_39 | AC | 85 ms
19,200 KB |
testcase_40 | AC | 97 ms
19,200 KB |
testcase_41 | AC | 99 ms
19,200 KB |
testcase_42 | AC | 89 ms
19,200 KB |
testcase_43 | AC | 93 ms
19,200 KB |
testcase_44 | AC | 84 ms
19,200 KB |
testcase_45 | AC | 86 ms
19,200 KB |
testcase_46 | AC | 83 ms
19,200 KB |
testcase_47 | AC | 83 ms
19,072 KB |
testcase_48 | AC | 89 ms
19,200 KB |
testcase_49 | AC | 89 ms
19,200 KB |
testcase_50 | AC | 89 ms
19,072 KB |
testcase_51 | AC | 89 ms
19,328 KB |
testcase_52 | AC | 86 ms
19,072 KB |
testcase_53 | AC | 89 ms
19,200 KB |
testcase_54 | AC | 83 ms
19,200 KB |
testcase_55 | AC | 91 ms
19,200 KB |
testcase_56 | AC | 85 ms
19,200 KB |
testcase_57 | AC | 91 ms
19,072 KB |
testcase_58 | AC | 87 ms
19,072 KB |
testcase_59 | AC | 90 ms
19,072 KB |
testcase_60 | AC | 99 ms
19,200 KB |
testcase_61 | AC | 99 ms
19,200 KB |
testcase_62 | AC | 88 ms
19,072 KB |
testcase_63 | AC | 85 ms
19,200 KB |
testcase_64 | AC | 83 ms
19,072 KB |
testcase_65 | AC | 84 ms
19,200 KB |
testcase_66 | AC | 83 ms
19,072 KB |
testcase_67 | AC | 84 ms
19,072 KB |
testcase_68 | AC | 89 ms
19,200 KB |
testcase_69 | AC | 83 ms
19,200 KB |
testcase_70 | AC | 85 ms
19,072 KB |
testcase_71 | AC | 94 ms
19,200 KB |
testcase_72 | AC | 87 ms
19,200 KB |
testcase_73 | AC | 84 ms
19,200 KB |
testcase_74 | AC | 89 ms
19,072 KB |
testcase_75 | AC | 84 ms
19,200 KB |
testcase_76 | AC | 94 ms
19,072 KB |
testcase_77 | AC | 85 ms
19,072 KB |
testcase_78 | AC | 83 ms
19,200 KB |
testcase_79 | AC | 87 ms
19,072 KB |
testcase_80 | AC | 87 ms
19,072 KB |
testcase_81 | AC | 98 ms
19,200 KB |
testcase_82 | AC | 98 ms
19,200 KB |
testcase_83 | AC | 94 ms
19,072 KB |
testcase_84 | AC | 87 ms
19,072 KB |
testcase_85 | AC | 84 ms
19,072 KB |
testcase_86 | AC | 85 ms
19,200 KB |
testcase_87 | AC | 88 ms
19,200 KB |
testcase_88 | AC | 88 ms
19,200 KB |
testcase_89 | AC | 89 ms
19,200 KB |
testcase_90 | AC | 94 ms
19,200 KB |
testcase_91 | AC | 88 ms
19,200 KB |
testcase_92 | AC | 86 ms
19,200 KB |
testcase_93 | AC | 84 ms
19,200 KB |
testcase_94 | AC | 89 ms
19,200 KB |
testcase_95 | AC | 86 ms
19,200 KB |
testcase_96 | AC | 86 ms
19,200 KB |
testcase_97 | AC | 91 ms
19,200 KB |
testcase_98 | AC | 88 ms
19,072 KB |
testcase_99 | AC | 86 ms
19,200 KB |
testcase_100 | AC | 88 ms
19,200 KB |
testcase_101 | AC | 90 ms
19,200 KB |
testcase_102 | AC | 98 ms
19,200 KB |
testcase_103 | AC | 99 ms
19,200 KB |
testcase_104 | AC | 98 ms
19,200 KB |
testcase_105 | AC | 92 ms
19,072 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- ll N; ll p10[20]; string A; ll ret=0; void solve() { int i,j,k,l,r,x,y; string s; p10[0]=1; FOR(i,10) p10[i+1]=p10[i]+1; set<string> V; for(i=1;i<=99999;i++) { char buf[1010]; string S,T; sprintf(buf,"%d",i); S=buf; T=S; reverse(ALL(T)); V.insert(S+T); V.insert(S+T.substr(1)); } cin>>A; string Z="000000000000000"; FORR(a,V) { if(a.size()>9) continue; string b = a+Z.substr(0,9-a.size())+a; if(b.size()<A.size() || (b.size()==A.size() && b<=A)) ret++; } cout<<ret<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }