結果

問題 No.1185 完全な3の倍数
ユーザー 👑 kmjpkmjp
提出日時 2020-08-22 13:18:21
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 1,050 bytes
コンパイル時間 2,123 ms
コンパイル使用メモリ 207,520 KB
実行使用メモリ 16,824 KB
最終ジャッジ日時 2023-08-15 23:42:19
合計ジャッジ時間 7,569 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
16,660 KB
testcase_01 AC 93 ms
16,700 KB
testcase_02 AC 92 ms
16,740 KB
testcase_03 AC 92 ms
16,736 KB
testcase_04 AC 93 ms
16,508 KB
testcase_05 AC 93 ms
16,480 KB
testcase_06 AC 93 ms
16,532 KB
testcase_07 AC 93 ms
16,804 KB
testcase_08 AC 94 ms
16,704 KB
testcase_09 AC 94 ms
16,620 KB
testcase_10 AC 93 ms
16,728 KB
testcase_11 AC 95 ms
16,740 KB
testcase_12 AC 93 ms
16,512 KB
testcase_13 AC 94 ms
16,696 KB
testcase_14 AC 94 ms
16,744 KB
testcase_15 AC 93 ms
16,740 KB
testcase_16 AC 93 ms
16,768 KB
testcase_17 AC 91 ms
16,532 KB
testcase_18 AC 93 ms
16,476 KB
testcase_19 AC 94 ms
16,740 KB
testcase_20 AC 92 ms
16,520 KB
testcase_21 AC 94 ms
16,576 KB
testcase_22 AC 94 ms
16,568 KB
testcase_23 AC 93 ms
16,700 KB
testcase_24 AC 94 ms
16,704 KB
testcase_25 AC 92 ms
16,664 KB
testcase_26 AC 92 ms
16,504 KB
testcase_27 AC 93 ms
16,596 KB
testcase_28 AC 93 ms
16,504 KB
testcase_29 AC 94 ms
16,728 KB
testcase_30 AC 93 ms
16,700 KB
testcase_31 AC 92 ms
16,704 KB
testcase_32 AC 94 ms
16,824 KB
testcase_33 AC 93 ms
16,640 KB
testcase_34 AC 93 ms
16,616 KB
testcase_35 AC 94 ms
16,648 KB
testcase_36 AC 94 ms
16,736 KB
testcase_37 AC 94 ms
16,480 KB
testcase_38 AC 94 ms
16,484 KB
testcase_39 AC 93 ms
16,744 KB
testcase_40 AC 93 ms
16,660 KB
testcase_41 AC 92 ms
16,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	set<int> S;
	for(i=12;i<=99;i+=3) S.insert(i);
	
	vector<int> C;
	C.push_back(0);
	FOR(i,9) {
		vector<int> D;
		FORR(c,C) {
			for(j=0;j<=9;j+=3) {
				x=c*10+j;
				S.insert(x);
				D.push_back(x);
			}
		}
		swap(C,D);
	}
	
	int N;
	cin>>N;
	int ret=0;
	FORR(s,S) {
		if(s>=10 && s<=N) {
			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);
	cout.tie(0); solve(); return 0;
}
0