結果

問題 No.491 10^9+1と回文
ユーザー goodbatongoodbaton
提出日時 2017-05-30 23:04:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,147 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 88,448 KB
実行使用メモリ 9,004 KB
最終ジャッジ日時 2023-10-21 18:06:11
合計ジャッジ時間 4,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 42 ms
4,416 KB
testcase_04 AC 39 ms
4,348 KB
testcase_05 AC 42 ms
4,348 KB
testcase_06 AC 80 ms
9,000 KB
testcase_07 AC 24 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 4 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 39 ms
4,348 KB
testcase_15 AC 9 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 4 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 4 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 39 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 37 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 20 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 3 ms
4,348 KB
testcase_35 AC 34 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 2 ms
4,348 KB
testcase_40 AC 1 ms
4,348 KB
testcase_41 AC 3 ms
4,348 KB
testcase_42 AC 2 ms
4,348 KB
testcase_43 AC 2 ms
4,348 KB
testcase_44 AC 2 ms
4,348 KB
testcase_45 AC 1 ms
4,348 KB
testcase_46 AC 3 ms
4,348 KB
testcase_47 AC 1 ms
4,348 KB
testcase_48 AC 1 ms
4,348 KB
testcase_49 AC 1 ms
4,348 KB
testcase_50 AC 3 ms
4,348 KB
testcase_51 AC 37 ms
4,348 KB
testcase_52 AC 1 ms
4,348 KB
testcase_53 AC 1 ms
4,348 KB
testcase_54 AC 1 ms
4,348 KB
testcase_55 AC 1 ms
4,348 KB
testcase_56 AC 2 ms
4,348 KB
testcase_57 AC 3 ms
4,348 KB
testcase_58 AC 39 ms
4,348 KB
testcase_59 AC 2 ms
4,348 KB
testcase_60 AC 2 ms
4,348 KB
testcase_61 AC 2 ms
4,348 KB
testcase_62 AC 4 ms
4,348 KB
testcase_63 AC 39 ms
4,348 KB
testcase_64 AC 2 ms
4,348 KB
testcase_65 AC 1 ms
4,348 KB
testcase_66 AC 1 ms
4,348 KB
testcase_67 AC 44 ms
4,728 KB
testcase_68 AC 2 ms
4,348 KB
testcase_69 AC 1 ms
4,348 KB
testcase_70 AC 1 ms
4,348 KB
testcase_71 AC 21 ms
4,348 KB
testcase_72 AC 3 ms
4,348 KB
testcase_73 AC 4 ms
4,348 KB
testcase_74 AC 2 ms
4,348 KB
testcase_75 AC 2 ms
4,348 KB
testcase_76 AC 1 ms
4,348 KB
testcase_77 AC 1 ms
4,348 KB
testcase_78 AC 4 ms
4,348 KB
testcase_79 AC 5 ms
4,348 KB
testcase_80 AC 1 ms
4,348 KB
testcase_81 AC 2 ms
4,348 KB
testcase_82 AC 2 ms
4,348 KB
testcase_83 AC 5 ms
4,348 KB
testcase_84 AC 1 ms
4,348 KB
testcase_85 AC 5 ms
4,348 KB
testcase_86 AC 1 ms
4,348 KB
testcase_87 AC 2 ms
4,348 KB
testcase_88 AC 1 ms
4,348 KB
testcase_89 AC 2 ms
4,348 KB
testcase_90 AC 4 ms
4,348 KB
testcase_91 AC 5 ms
4,348 KB
testcase_92 AC 2 ms
4,348 KB
testcase_93 AC 4 ms
4,348 KB
testcase_94 AC 32 ms
4,348 KB
testcase_95 AC 1 ms
4,348 KB
testcase_96 AC 2 ms
4,348 KB
testcase_97 AC 45 ms
4,892 KB
testcase_98 AC 80 ms
8,944 KB
testcase_99 AC 71 ms
7,960 KB
testcase_100 WA -
testcase_101 AC 63 ms
7,072 KB
testcase_102 AC 65 ms
7,204 KB
testcase_103 AC 81 ms
9,000 KB
testcase_104 WA -
testcase_105 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |   scanf("%lld",&n);
      |   ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  ll n;
  set<ll> mm;
  scanf("%lld",&n);

  int m = n/1000000000;

  int ans = 0;
  
  for(int i=0;i<=m;i++){
    int p = i;

    char s1[20],s1_r[20],s2[20];

    sprintf(s1_r,"%d",p);
    reverse(s1_r,s1_r+strlen(s1_r));
    
    sprintf(s1,"%d%s",p,s1_r);
    sprintf(s2,"%d%s",p/10,s1_r);

    ll q1 = atoll(s1);    
    ll q2 = atoll(s2);

    //debug(q1);
    //debug(q2);
    
    if(q1 <= m && mm.find(q1) == mm.end()){
      mm.insert(q1);
      ans++;
    }

    if(q2 <= m && mm.find(q2) == mm.end()){
      mm.insert(q2);
      ans++;
    }

    if(q1 >= 10000000000LL) break;
  }
  
  cout << ans-1 << endl;
  
  return 0;
}
0