Skip to content
GG
Ghost Graph
Ghost Graph: Interlinked notes, diagnostics, and proven scripts rendered as a navigable 3D graph.
Reading

UVa Online Judge Challenge "10110"

Return to map
Categories Java

Problem

My Solution

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {

			boolean light = true;
			long n = sc.nextLong();

			if (n == 0) {
				System.exit(0);
			}

			long a = Math.round(Math.sqrt(n));

			if ((a * a) == n) {
				light = true;
			} else {
				light = false;
			}

			if (light) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}

		}
	}
}