Submission #1073749
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MAX_N = 100000;
int N, A[MAX_N], B[MAX_N];
signed main()
{
cin >> N;
for (int i = 0; i < N; i++)
{
cin >> A[i] >> B[i];
}
int sum = 0;
for (int i = N - 1; i >= 0; i--)
{
sum += B[i] - (A[i] + sum + B[i] - 1)%B[i] - 1;
}
printf("%lld\n", sum);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Multiple Array |
| User | winjii |
| Language | C++14 (GCC 5.4.1) |
| Score | 300 |
| Code Size | 370 Byte |
| Status | AC |
| Exec Time | 146 ms |
| Memory | 1792 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, s1.txt, s2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 134 ms | 1792 KiB |
| 02.txt | AC | 124 ms | 1792 KiB |
| 03.txt | AC | 133 ms | 1792 KiB |
| 04.txt | AC | 133 ms | 1792 KiB |
| 05.txt | AC | 126 ms | 1792 KiB |
| 06.txt | AC | 134 ms | 1792 KiB |
| 07.txt | AC | 81 ms | 1792 KiB |
| 08.txt | AC | 139 ms | 1792 KiB |
| 09.txt | AC | 86 ms | 1792 KiB |
| 10.txt | AC | 141 ms | 1792 KiB |
| 11.txt | AC | 88 ms | 1792 KiB |
| 12.txt | AC | 39 ms | 1792 KiB |
| 13.txt | AC | 87 ms | 1792 KiB |
| 14.txt | AC | 146 ms | 1792 KiB |
| 15.txt | AC | 3 ms | 256 KiB |
| 16.txt | AC | 2 ms | 256 KiB |
| s1.txt | AC | 3 ms | 256 KiB |
| s2.txt | AC | 2 ms | 256 KiB |