Submission #48582631
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
bool in_mass(int x, int y, int w, int h) {
return x >= 0 && y >= 0 && x < w && y < h;
}
const int dx[8] = {0, 0, -1, 1, 1, 1, -1, -1};
const int dy[8] = {-1, 1, 0, 0, -1, 1, 1, -1};
int main() {
int n;
cin >> n;
vector<int> v(100, 0);
// 1 * 3
v[0] = 3;
int cnt;
int max_i;
cnt = 1;
max_i = 1;
int i = 0;
while(cnt < n) {
if(v[i] > 0) {
int tmp = v[i];
v[i] = 0;
v[i + 1]++;
v[0] = tmp - 1;
max_i = max(max_i, i + 1);
cnt++;
i = 0;
} else {
i++;
}
}
long long sum = 0;
long long add = 1;
for(int i = 0; i <= max_i; i++) {
sum += add * v[i];
add = add * 10 + 1;
}
cout << sum << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Repunit Trio |
| User | nnth_y |
| Language | C++ 20 (gcc 12.2) |
| Score | 300 |
| Code Size | 921 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3616 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3548 KiB |
| 00_sample_02.txt | AC | 1 ms | 3544 KiB |
| 00_sample_03.txt | AC | 1 ms | 3488 KiB |
| 01_test_01.txt | AC | 1 ms | 3472 KiB |
| 01_test_02.txt | AC | 1 ms | 3544 KiB |
| 01_test_03.txt | AC | 1 ms | 3488 KiB |
| 01_test_04.txt | AC | 1 ms | 3616 KiB |
| 01_test_05.txt | AC | 1 ms | 3468 KiB |
| 01_test_06.txt | AC | 1 ms | 3540 KiB |
| 01_test_07.txt | AC | 1 ms | 3452 KiB |
| 01_test_08.txt | AC | 1 ms | 3412 KiB |
| 01_test_09.txt | AC | 1 ms | 3612 KiB |
| 01_test_10.txt | AC | 1 ms | 3480 KiB |
| 01_test_11.txt | AC | 1 ms | 3488 KiB |
| 01_test_12.txt | AC | 1 ms | 3452 KiB |
| 01_test_13.txt | AC | 1 ms | 3540 KiB |
| 01_test_14.txt | AC | 1 ms | 3612 KiB |
| 01_test_15.txt | AC | 1 ms | 3540 KiB |
| 01_test_16.txt | AC | 1 ms | 3408 KiB |
| 01_test_17.txt | AC | 1 ms | 3460 KiB |