SOLUTION INFO
C++ · main.cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N; cin >> N;
int ans = 0;
for(int i = 1; i <= N; ++i) {
int tmp = i;
while(tmp) {
int cur = tmp % 10;
if(cur != 0 && cur % 3 == 0) ++ ans;
tmp /= 10;
}
}
cout << ans;
return 0;
}
SOLUTION DESCRIPTION
풀이 설명
주어진대로 구현하면 되는 문제.