Submission #22512082
Source Code Expand
import sys
input = sys.stdin.readline
def main():
n = int(input())
a, b, c = map(int, input().split())
lim = 10000
ans = lim
for i in range(lim):
for j in range(lim):
rem = n - a * i - b * j
if rem < 0:
break
if rem % c == 0:
ans = min(ans, i + j + rem // c)
print(ans)
if __name__ == "__main__":
main()
Submission Info
| Submission Time | |
|---|---|
| Task | 016 - Minimum Coins(★3) |
| User | riantkb |
| Language | PyPy3 (7.3.0) |
| Score | 3 |
| Code Size | 414 Byte |
| Status | AC |
| Exec Time | 1247 ms |
| Memory | 67676 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 3 / 3 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt |
| All | rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, rand_06.txt, rand_07.txt, rand_08.txt, rand_09.txt, rand_10.txt, rand_large_abc_1.txt, rand_large_abc_2.txt, rand_large_abc_3.txt, sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, small_1.txt, small_2.txt, small_3.txt, small_4.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| rand_01.txt | AC | 516 ms | 67368 KiB |
| rand_02.txt | AC | 460 ms | 67440 KiB |
| rand_03.txt | AC | 672 ms | 65816 KiB |
| rand_04.txt | AC | 492 ms | 67220 KiB |
| rand_05.txt | AC | 487 ms | 67320 KiB |
| rand_06.txt | AC | 474 ms | 67440 KiB |
| rand_07.txt | AC | 661 ms | 67384 KiB |
| rand_08.txt | AC | 684 ms | 65896 KiB |
| rand_09.txt | AC | 481 ms | 67200 KiB |
| rand_10.txt | AC | 711 ms | 67372 KiB |
| rand_large_abc_1.txt | AC | 56 ms | 65540 KiB |
| rand_large_abc_2.txt | AC | 61 ms | 67272 KiB |
| rand_large_abc_3.txt | AC | 1247 ms | 65176 KiB |
| sample_1.txt | AC | 71 ms | 63816 KiB |
| sample_2.txt | AC | 197 ms | 67204 KiB |
| sample_3.txt | AC | 134 ms | 67568 KiB |
| sample_4.txt | AC | 655 ms | 65648 KiB |
| small_1.txt | AC | 983 ms | 67676 KiB |
| small_2.txt | AC | 71 ms | 63864 KiB |
| small_3.txt | AC | 54 ms | 63800 KiB |
| small_4.txt | AC | 55 ms | 63808 KiB |