Submission #18003


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Main{
static Scanner s=new Scanner(System.in);
public static void main(String[]__){
int[] in=new int[s.nextInt()+1];
for(int i=1;i<in.length;i++)in[i]=Integer.parseInt(s.next());
Arrays.parallelPrefix(in,Integer::sum);
System.out.println(Arrays.stream(in).parallel().mapToObj(String::valueOf).collect(Collectors.joining(" ")));
for(int i=s.nextInt();i>0;i--) {
int l=Integer.parseInt(s.next()),r=Integer.parseInt(s.next());
System.out.println(in[r]-in[l-1]);
}
}
}

ステータス

項目 データ
問題 0733 - プログラミング入門:累積和
ユーザー名 fal_rnd
投稿日時 2017-05-26 19:20:13
言語 Java
状態 Accepted
得点 5
ソースコード長 604 Byte
最大実行時間 4337 ms
最大メモリ使用量 225444 KB

セット

セット 得点 Cases
1 ALL 5 / 5 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 650 ms 151508 KB
1
Input02 AC 688 ms 162348 KB
1
Input03 AC 1066 ms 189096 KB
1
Input04 AC 4337 ms 203000 KB
1
Input05 AC 4237 ms 225444 KB
1