Submission #2374323


Source Code Expand

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
//		for(int i = 2 ; i < 1000 ; i++) {
//			for(int j = 2 ; j < 1000 ; j++) {
//				for(int k = 2 ; k < 1000 ; k++) {
//					if(i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && i + j == j + k && j + k == k + i) {
//						System.out.println(i + " " + j + " " + k);
//					}
//				}
//			}
//		}
		if(a == b && b == c) {
			System.out.println(-1);
			return;
		}
		if(!(a % 2 == 0 && b % 2 == 0 && c % 2 == 0)) {
			System.out.println(1);
			return;
		}
		long ans = 0;
		while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
			ans++;
			long x = a / 2 + b / 2;
			long y = b / 2 + c / 2;
			long z = c / 2 + a / 2;
			a = y;
			b = z;
			c = x;
			System.out.println(a + " " + b + " " + c);
		}
		System.out.println(ans);
	}
}

// a = b/2 + c/2
// b = c/2 + a/2
// c = a/2 + b/2
// a == b == c => b/2 + c/2 == c/2 + a/2 == a/2 + b/2 => b + c == c + a == a + b

Submission Info

Submission Time
Task A - Cookie Exchanges
User kouta1612
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1098 Byte
Status WA
Exec Time 93 ms
Memory 23252 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 2
AC × 4
WA × 13
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
in1.txt WA 93 ms 21588 KB
in10.txt WA 90 ms 19412 KB
in11.txt AC 92 ms 19028 KB
in2.txt WA 91 ms 19796 KB
in3.txt WA 92 ms 23252 KB
in4.txt WA 93 ms 21204 KB
in5.txt WA 92 ms 18772 KB
in6.txt WA 92 ms 21844 KB
in7.txt WA 92 ms 18772 KB
in8.txt WA 92 ms 19412 KB
in9.txt AC 92 ms 19028 KB
sample1.txt WA 91 ms 19284 KB
sample2.txt AC 92 ms 19796 KB
sample3.txt WA 92 ms 20820 KB