Submission #23581807
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define endl "\n"
#define rep(i, n) for (int i = 0; i < n; i++)
//#define sort(v) sort(v.begin(), v.end());
//#define rsort(v) sort(v.rbegin(), v.rend());
void solve()
{
ll n;
cin >> n;
ll sum = 0;
for (int i = 0;; i++)
{
sum += i + 1;
if (sum >= n)
{
cout << i + 1 << endl;
return;
}
}
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.in", "r", stdin);
freopen("output.in", "w", stdout);
#endif
int t;
t = 1;
while (t--)
{
solve();
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Savings |
| User | EramallaAravind |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 691 Byte |
| Status | AC |
| Exec Time | 8 ms |
| Memory | 3628 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 | 8 ms | 3496 KiB |
| sample_02.txt | AC | 2 ms | 3576 KiB |
| test_01.txt | AC | 3 ms | 3528 KiB |
| test_02.txt | AC | 2 ms | 3604 KiB |
| test_03.txt | AC | 2 ms | 3628 KiB |
| test_04.txt | AC | 2 ms | 3576 KiB |
| test_05.txt | AC | 2 ms | 3628 KiB |
| test_06.txt | AC | 3 ms | 3412 KiB |
| test_07.txt | AC | 2 ms | 3384 KiB |
| test_08.txt | AC | 2 ms | 3588 KiB |