Submission #18886539
Source Code Expand
N = int(input())
arr8 = [0] * (N + 1)
arr10 = [0] * (N + 1)
def exist(x):
num = x
while num:
num //= 8
if arr8[num]:
arr8[x] = True
return 1
num = x
while num:
num //= 10
if arr10[num]:
arr10[x] = True
return 1
return 0
ans = 0
count8 = 1
count10 = 1
for i in range(1, N+1):
found = False
preans = ans
if count8 == 7:
arr8[i] = 1
found = True
if count10 == 7:
arr10[i] = 1
found = True
elif exist(i):
found = True
count10 += 1
count8 += 1
if count10 == 10:
count10 = 0
if count8 == 8:
count8 = 0
if found:
ans += 1
print(N - ans)
Submission Info
| Submission Time | |
|---|---|
| Task | C - Unlucky 7 |
| User | noyan |
| Language | Python (3.8.2) |
| Score | 300 |
| Code Size | 784 Byte |
| Status | AC |
| Exec Time | 99 ms |
| Memory | 10320 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | hand_01.txt, hand_02.txt, hand_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_01.txt, sample_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| hand_01.txt | AC | 19 ms | 8956 KiB |
| hand_02.txt | AC | 99 ms | 10244 KiB |
| hand_03.txt | AC | 77 ms | 9984 KiB |
| random_01.txt | AC | 70 ms | 9792 KiB |
| random_02.txt | AC | 35 ms | 9168 KiB |
| random_03.txt | AC | 51 ms | 9356 KiB |
| random_04.txt | AC | 82 ms | 10188 KiB |
| random_05.txt | AC | 62 ms | 9532 KiB |
| random_06.txt | AC | 87 ms | 10320 KiB |
| random_07.txt | AC | 48 ms | 9528 KiB |
| random_08.txt | AC | 88 ms | 10256 KiB |
| random_09.txt | AC | 26 ms | 9148 KiB |
| random_10.txt | AC | 58 ms | 9512 KiB |
| random_11.txt | AC | 24 ms | 9104 KiB |
| random_12.txt | AC | 95 ms | 10144 KiB |
| random_13.txt | AC | 74 ms | 9776 KiB |
| random_14.txt | AC | 21 ms | 9124 KiB |
| random_15.txt | AC | 74 ms | 9888 KiB |
| sample_01.txt | AC | 20 ms | 9108 KiB |
| sample_02.txt | AC | 99 ms | 10280 KiB |