Submission #23590302
Source Code Expand
import math
n = int(input())
part = (-1 + math.sqrt(1 + 8 * n)) / 2
bench = int(part)
for i in range(max(0, bench - 5), bench + 100):
if i * (i + 1) // 2 >= n:
print(i)
break
Submission Info
| Submission Time | |
|---|---|
| Task | B - Savings |
| User | cubesat |
| Language | Python (3.8.2) |
| Score | 200 |
| Code Size | 207 Byte |
| Status | AC |
| Exec Time | 26 ms |
| Memory | 9172 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 |
| All | sample_01.txt, sample_02.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 19 ms | 9104 KiB |
| sample_02.txt | AC | 19 ms | 9040 KiB |
| test_01.txt | AC | 19 ms | 9172 KiB |
| test_02.txt | AC | 18 ms | 8876 KiB |
| test_03.txt | AC | 18 ms | 8872 KiB |
| test_04.txt | AC | 18 ms | 9036 KiB |
| test_05.txt | AC | 25 ms | 9036 KiB |
| test_06.txt | AC | 26 ms | 8976 KiB |
| test_07.txt | AC | 26 ms | 9164 KiB |
| test_08.txt | AC | 21 ms | 8876 KiB |