Submission #1073414
Source Code Expand
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,ii ) for( typeof(gg.begin()) ii=gg.begin();ii!=gg.end();ii++)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define sz(a) int((a).size())
#define N 1000010
#define MAX 30
#define mod 1000000007
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define all(a) a.begin(),a.end()
const ll INF = 1e18+1;
ll a[N],b[N];
int main()
{
ll t,x=0,y;
scanf("%lld",&t);
REP(i,t) scanf("%lld%lld",&a[i],&b[i]);
REPP(i,1,t+1){
y=(a[t-i]+x)%b[t-i];
if (y) x+=b[t-i]-y;
}
printf("%lld\n",x);
return 0;
}
Submission Info
Submission Time
2017-01-22 21:03:20+0900
Task
A - Multiple Array
User
TerryMcGinnis
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
821 Byte
Status
AC
Exec Time
26 ms
Memory
1792 KiB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:28:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&t);
^
./Main.cpp:29:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
REP(i,t) scanf("%lld%lld",&a[i],&b[i]);
^
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
26 ms
1792 KiB
02.txt
AC
26 ms
1792 KiB
03.txt
AC
26 ms
1792 KiB
04.txt
AC
26 ms
1792 KiB
05.txt
AC
26 ms
1792 KiB
06.txt
AC
26 ms
1792 KiB
07.txt
AC
21 ms
1792 KiB
08.txt
AC
26 ms
1792 KiB
09.txt
AC
21 ms
1792 KiB
10.txt
AC
26 ms
1792 KiB
11.txt
AC
21 ms
1792 KiB
12.txt
AC
17 ms
1792 KiB
13.txt
AC
21 ms
1792 KiB
14.txt
AC
26 ms
1792 KiB
15.txt
AC
3 ms
256 KiB
16.txt
AC
3 ms
256 KiB
s1.txt
AC
3 ms
256 KiB
s2.txt
AC
3 ms
256 KiB