Submission #73051777
Source Code Expand
import sys
from collections import defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lii = lambda: list(mii())
MOD = 10**9+7
inf = 1<<64
def solve():
n,k = mii()
ans = 0
for i in range(n+1):
if sum(int(x) for x in str(i))==k:
ans+=1
print(ans)
t = 1
# t = ii()
for _ in range(t):
solve()
Submission Info
| Submission Time | |
|---|---|
| Task | B - Digit Sum |
| User | xiaoe |
| Language | Python (PyPy 3.11-v7.3.20) |
| Score | 200 |
| Code Size | 419 Byte |
| Status | AC |
| Exec Time | 92 ms |
| Memory | 109184 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | 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, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| random_01.txt | AC | 90 ms | 109184 KiB |
| random_02.txt | AC | 89 ms | 108988 KiB |
| random_03.txt | AC | 63 ms | 93448 KiB |
| random_04.txt | AC | 91 ms | 109180 KiB |
| random_05.txt | AC | 77 ms | 108828 KiB |
| random_06.txt | AC | 92 ms | 108772 KiB |
| random_07.txt | AC | 84 ms | 108808 KiB |
| random_08.txt | AC | 90 ms | 108968 KiB |
| random_09.txt | AC | 89 ms | 108780 KiB |
| sample_01.txt | AC | 63 ms | 93528 KiB |
| sample_02.txt | AC | 72 ms | 106240 KiB |
| sample_03.txt | AC | 88 ms | 108828 KiB |