Submission #1074518
Source Code Expand
// // main.c // GrandContest009_A_MultipleArray // // Created by T.T on 2017/01/22. // Copyright © 2017年 T.T. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXAB 100000 int N=0; int A[MAXAB+1] = {}; int B[MAXAB+1] = {}; void load(){ scanf("%d", &N); int i; //A,Bの添え字は1~なことに注意ß for(i=1; i<N+1; i++){ scanf("%d %d", &A[i], &B[i]); } } //n個目のボタンをc回おす void push(int n, int c){ int i; for(i=1; i<=n; i++)A[i]+=c; } //ボタン押した回数 int count = 0; //A,Bの要素を与えて、何回ボタン押せば整数倍になるか計算 int culc(int a, int b){ int mul = a/b; if(mul==0) mul = 1; while(a>mul){ mul += b; } return mul - a; } void solve(){ int i; for(i=N; i>=1; i--){ int tempcnt = culc(A[i], B[i]); count += tempcnt; push(i, tempcnt); } printf("%d\n", count-1); } int main(int argc, const char * argv[]) { load(); solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | cc599 |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 1144 Byte |
Status | WA |
Exec Time | 2102 ms |
Memory | 896 KB |
Compile Error
./Main.c: In function ‘load’: ./Main.c:20:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ ./Main.c:25:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d", &A[i], &B[i]); ^
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 | TLE | 2102 ms | 896 KB |
02.txt | TLE | 2102 ms | 896 KB |
03.txt | TLE | 2102 ms | 896 KB |
04.txt | TLE | 2102 ms | 896 KB |
05.txt | TLE | 2102 ms | 896 KB |
06.txt | TLE | 2102 ms | 896 KB |
07.txt | TLE | 2102 ms | 896 KB |
08.txt | TLE | 2102 ms | 896 KB |
09.txt | TLE | 2102 ms | 896 KB |
10.txt | TLE | 2102 ms | 896 KB |
11.txt | TLE | 2102 ms | 896 KB |
12.txt | TLE | 2102 ms | 896 KB |
13.txt | TLE | 2102 ms | 896 KB |
14.txt | TLE | 2102 ms | 896 KB |
15.txt | AC | 1 ms | 128 KB |
16.txt | AC | 1 ms | 128 KB |
s1.txt | AC | 1 ms | 128 KB |
s2.txt | WA | 1 ms | 128 KB |