URI Problem 1099 Solution in Java
Problem Details Link
Solution:
Solution:
import java.util.Scanner;
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @E-mail : md.parvez28@gmail.com
* @Date : Oct 17, 2016
* @Time : 7:44:30 PM
*/
public class Uri1099 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
int count = 0;
if (x > y) {
int temp = x;
x = y;
y = temp;
}
for (int j = (x + 1); j < y; j++) {
if (j % 2 != 0) {
count += j;
}
}
System.out.println(count);
}
}
}
0turi0cor-ji Adam Pierce https://wakelet.com/@avaciplau769
ReplyDeletebullracapki