AtCoder Grand Contest 009

Submission #1353340

Source codeソースコード

#include <stdio.h>

int main(){

  long long int n,i,j,count=0,tmp;
  long long int a[100010];
  long long int b[100010];

  scanf("%lld",&n);

  for(i = 0; i < n; i++){
    scanf("%lld %lld",&a[i],&b[i]);
  }

  for(i = n-1; i >= 0; i--){
    a[i] += count;
    if(a[i]% b[i] != 0){
      tmp=b[i] - a[i] % b[i];
      count += tmp;
    }
  }
  printf("%lld\n",count);
  return 0;
}

Submission

Task問題 A - Multiple Array
User nameユーザ名 swkfn
Created time投稿日時
Language言語 C (GCC 5.4.1)
Status状態 AC
Score得点 300
Source lengthソースコード長 408 Byte
File nameファイル名
Exec time実行時間 24 ms
Memory usageメモリ使用量 1664 KB

Compiler messageコンパイルメッセージ

./Main.c: In function ‘main’:
./Main.c:9:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&n);
^
./Main.c:12:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld",&a[i],&b[i]);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - s1.txt,s2.txt
All 300 / 300 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt AC 23 ms 1664 KB
02.txt AC 23 ms 1664 KB
03.txt AC 23 ms 1664 KB
04.txt AC 23 ms 1664 KB
05.txt AC 23 ms 1664 KB
06.txt AC 23 ms 1664 KB
07.txt AC 19 ms 1664 KB
08.txt AC 24 ms 1664 KB
09.txt AC 19 ms 1664 KB
10.txt AC 24 ms 1664 KB
11.txt AC 19 ms 1664 KB
12.txt AC 15 ms 1664 KB
13.txt AC 19 ms 1664 KB
14.txt AC 24 ms 1664 KB
15.txt AC 1 ms 128 KB
16.txt AC 1 ms 128 KB
s1.txt AC 1 ms 128 KB
s2.txt AC 1 ms 128 KB