結果

問題 No.1185 完全な3の倍数
ユーザー furafura
提出日時 2020-09-06 19:13:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 1,911 ms
コンパイル使用メモリ 200,208 KB
実行使用メモリ 8,932 KB
最終ジャッジ日時 2023-08-19 14:15:02
合計ジャッジ時間 3,627 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,072 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 6 ms
5,132 KB
testcase_04 AC 6 ms
5,076 KB
testcase_05 AC 6 ms
5,236 KB
testcase_06 AC 6 ms
5,072 KB
testcase_07 AC 6 ms
5,144 KB
testcase_08 AC 8 ms
8,932 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 6 ms
5,212 KB
testcase_21 AC 5 ms
5,128 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 5 ms
5,136 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 5 ms
5,012 KB
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 5 ms
5,268 KB
testcase_29 AC 4 ms
4,384 KB
testcase_30 AC 5 ms
5,128 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 6 ms
5,016 KB
testcase_33 AC 3 ms
4,380 KB
testcase_34 AC 5 ms
5,016 KB
testcase_35 AC 6 ms
5,196 KB
testcase_36 AC 5 ms
5,072 KB
testcase_37 AC 6 ms
5,384 KB
testcase_38 AC 5 ms
5,220 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int n;
vector<lint> res;

void dfs(lint x){
	if(x>n) return;
	if(x>=10) res.emplace_back(x);
	dfs(10*x);
	dfs(10*x+3);
	dfs(10*x+6);
	dfs(10*x+9);
}

int main(){
	scanf("%d",&n);

	dfs(3);
	dfs(6);
	dfs(9);

	rep(a,10) if(a>0) rep(b,10) if((a+b)%3==0 && a%3!=0 && b%3!=0) {
		if(10*a+b<=n) res.emplace_back(10*a+b);
	}
	printf("%ld\n",res.size());

	return 0;
}
0