Please sign in first.
Submission #26157430
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n;
cin >> n;
int64_t sum = 0;
vector<int> a(n);
for ( int i=0; i<n; i++ ) {
cin >> a.at(i);
sum += a.at(i);
}
int64_t x;
cin >> x;
int64_t q = x/sum;
x -= sum*q;
int i = 0;
while ( x>=0 ) {
x -= a.at(i);
i += 1;
}
cout << n*q+i << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Long Sequence |
| User | RoadLynton27 |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 388 Byte |
| Status | AC |
| Exec Time | 45 ms |
| Memory | 3788 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 7 ms | 3492 KiB |
| 001.txt | AC | 2 ms | 3600 KiB |
| 002.txt | AC | 2 ms | 3436 KiB |
| 003.txt | AC | 40 ms | 3624 KiB |
| 004.txt | AC | 43 ms | 3420 KiB |
| 005.txt | AC | 38 ms | 3788 KiB |
| 006.txt | AC | 14 ms | 3520 KiB |
| 007.txt | AC | 19 ms | 3656 KiB |
| 008.txt | AC | 12 ms | 3616 KiB |
| 009.txt | AC | 40 ms | 3728 KiB |
| 010.txt | AC | 41 ms | 3500 KiB |
| 011.txt | AC | 39 ms | 3752 KiB |
| 012.txt | AC | 32 ms | 3552 KiB |
| 013.txt | AC | 19 ms | 3472 KiB |
| 014.txt | AC | 23 ms | 3624 KiB |
| 015.txt | AC | 44 ms | 3788 KiB |
| 016.txt | AC | 45 ms | 3712 KiB |
| 017.txt | AC | 37 ms | 3520 KiB |
| 018.txt | AC | 33 ms | 3436 KiB |
| 019.txt | AC | 39 ms | 3596 KiB |
| 020.txt | AC | 27 ms | 3552 KiB |
| 021.txt | AC | 16 ms | 3496 KiB |
| example0.txt | AC | 2 ms | 3416 KiB |
| example1.txt | AC | 2 ms | 3604 KiB |