Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import java.util.Scanner;
public class UVA12918 {
public static void main(String[] args) {
Scanner sc = new Scanner(;
int T = sc.nextInt();
while(T-->0) {
int n = sc.nextInt();
int m = sc.nextInt();
int extra = m - n;
int sum = n * extra;
sum = sum + (n-1)*n/2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.