We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5fff427 commit 52270d8Copy full SHA for 52270d8
atcoder/abc186/C/main.cpp
@@ -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
17
+ if (N % 8 == 7) return true;
18
+ N /= 8;
19
20
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