結果

問題 No.1185 完全な3の倍数
ユーザー RhoRho
提出日時 2020-07-31 11:22:25
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 1,624 ms
コンパイル使用メモリ 169,740 KB
実行使用メモリ 5,136 KB
最終ジャッジ日時 2023-08-15 23:39:00
合計ジャッジ時間 4,171 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
4,924 KB
testcase_01 AC 19 ms
4,988 KB
testcase_02 AC 19 ms
5,008 KB
testcase_03 AC 19 ms
5,072 KB
testcase_04 AC 20 ms
4,988 KB
testcase_05 AC 20 ms
4,864 KB
testcase_06 AC 20 ms
4,992 KB
testcase_07 AC 19 ms
5,088 KB
testcase_08 AC 20 ms
5,012 KB
testcase_09 AC 20 ms
4,880 KB
testcase_10 AC 19 ms
5,064 KB
testcase_11 AC 19 ms
5,024 KB
testcase_12 AC 20 ms
5,084 KB
testcase_13 AC 20 ms
4,872 KB
testcase_14 AC 21 ms
4,948 KB
testcase_15 AC 19 ms
5,068 KB
testcase_16 AC 20 ms
4,868 KB
testcase_17 AC 20 ms
4,872 KB
testcase_18 AC 20 ms
5,068 KB
testcase_19 AC 20 ms
5,068 KB
testcase_20 AC 20 ms
5,128 KB
testcase_21 AC 20 ms
5,084 KB
testcase_22 AC 20 ms
4,872 KB
testcase_23 AC 20 ms
4,828 KB
testcase_24 AC 20 ms
4,872 KB
testcase_25 AC 20 ms
4,944 KB
testcase_26 AC 20 ms
4,948 KB
testcase_27 AC 20 ms
4,868 KB
testcase_28 AC 21 ms
4,820 KB
testcase_29 AC 20 ms
5,084 KB
testcase_30 AC 20 ms
5,064 KB
testcase_31 AC 20 ms
4,920 KB
testcase_32 AC 20 ms
4,956 KB
testcase_33 AC 20 ms
4,924 KB
testcase_34 AC 20 ms
4,876 KB
testcase_35 AC 19 ms
5,064 KB
testcase_36 AC 20 ms
4,948 KB
testcase_37 AC 20 ms
5,068 KB
testcase_38 AC 20 ms
5,136 KB
testcase_39 AC 20 ms
4,940 KB
testcase_40 AC 20 ms
5,056 KB
testcase_41 AC 20 ms
4,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define all(a) a.begin(),a.end()
typedef pair<int,int> P;
const long long mod=1000000007;
const long long inf=1ll<<61;
vi ans;
void dfs(int now){
  if(now>mod)return;
  ans.push_back(now);
  dfs(now*10);
  dfs(now*10+3);
  dfs(now*10+6);
  dfs(now*10+9);
  return;
}
signed main(){
  dfs(3);dfs(6);dfs(9);
  sort(all(ans));
  int n;cin>>n;
  assert(10<=n&&n<=1000000000);
  int res=0;
  for(int i=10;i<100;i++){
    if(i<=n&&i%3==0)res++;
  }
  for(int e:ans){
    if(100<e&&e<=n)res++;
  }
  cout<<res<<endl;
}
0