Skip to content

Commit 52270d8

Browse files
committed
atcoder/abc186C
1 parent 5fff427 commit 52270d8

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

atcoder/abc186/C/main.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
bool contains7_on_10base(int N) {
8+
while (N > 0) {
9+
if (N % 10 == 7) return true;
10+
N /= 10;
11+
}
12+
return false;
13+
}
14+
15+
bool contains7_on_8base(int N) {
16+
while (N > 0) {
17+
if (N % 8 == 7) return true;
18+
N /= 8;
19+
}
20+
return false;
21+
}
22+
23+
int main() {
24+
ios_base::sync_with_stdio(false);
25+
cin.tie(0); cout.tie(0);
26+
27+
int N;
28+
cin >> N;
29+
30+
int ans = 0;
31+
for (int i = 1; i <= N; ++i) {
32+
if (contains7_on_10base(i)) continue;
33+
if (contains7_on_8base(i)) continue;
34+
++ans;
35+
}
36+
cout << ans << endl;
37+
38+
return 0;
39+
}

0 commit comments

Comments
 (0)