Submission #1439695


Source Code Expand

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 10005
#define INF 111111
using namespace std;

int a[1e5+5],b[1e5+5];
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 843 Byte
Status CE

Compile Error

./Main.cpp:10:12: error: size of array ‘a’ has non-integral type ‘double’
 int a[1e5+5],b[1e5+5];
            ^
./Main.cpp:10:21: error: size of array ‘b’ has non-integral type ‘double’
 int a[1e5+5],b[1e5+5];
                     ^