Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int times = scanner.nextInt();
- while (times-->0) {
- int[] nums = new int[times+1];
- for (int i = 0; i <times+1; i++) {
- nums[i] = scanner.nextInt();
- }
- int odds = 1;
- int evens = 1;
- for (int i = 0; i < nums.length; i += 2)
- odds *= nums[i];
- for (int j = 1; j < nums.length - 1; j+=2)
- evens *= nums[j];
- if (odds == evens) {
- System.out.println("yes "+odds);
- } else {
- System.out.println("no"+" "+odds+" "+evens);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment