Submission #1439731
Source Code Expand
#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #define N 1e5+5 #define INF 111111 using namespace std; long long a[10005],b[10005]; long long ans=0; inline long long read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int main(){ int i; int n; /*scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); } */ //freopen(".in","r",stdin); //freopen(".out","w",stdout); //int n; n=read(); for(i=0;i<n;i++){ a[i]=read(); b[i]=read(); } for(i=n-1;i+1;i--) ans=ans+(b[i]-(a[i]+ans)%b[i])%b[i]; //ans=b[i]-(a[i]+ans); //ans=ans%b[i]; //ans=ans+(ans%b[i]); printf("%lld\n",ans); //while(1); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | Malkavian |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 849 Byte |
Status | RE |
Exec Time | 99 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | RE | 97 ms | 384 KB |
02.txt | RE | 98 ms | 384 KB |
03.txt | RE | 99 ms | 384 KB |
04.txt | RE | 98 ms | 384 KB |
05.txt | RE | 98 ms | 384 KB |
06.txt | RE | 97 ms | 384 KB |
07.txt | RE | 97 ms | 384 KB |
08.txt | RE | 98 ms | 384 KB |
09.txt | RE | 98 ms | 384 KB |
10.txt | RE | 98 ms | 384 KB |
11.txt | RE | 98 ms | 384 KB |
12.txt | RE | 99 ms | 384 KB |
13.txt | RE | 99 ms | 384 KB |
14.txt | RE | 98 ms | 384 KB |
15.txt | AC | 1 ms | 256 KB |
16.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |