-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1292.java
More file actions
27 lines (23 loc) · 709 Bytes
/
1292.java
File metadata and controls
27 lines (23 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine()," ");
int a=Integer.parseInt(st.nextToken());
int b=Integer.parseInt(st.nextToken());
int arr[] = new int[1001];
arr[0]=0;
int index=1;
for(int i=1; i<1000; i++){
for(int j=0; j<i; j++){
arr[index]=arr[index-1]+i;
if(index==b){
System.out.println(arr[b]-arr[a-1]);
return;
}
index++;
}
}
}
}