Pages

Sunday 9 September 2012

UVA - 11854 - Egypt (java Solution)

import java.io.*;
import java.util.IllegalFormatException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;


public class Main{

    public static void main(String[] args) throws FileNotFoundException, IOException {
            TextIO.readStream(System.in);
               
            while (true){
                long x=TextIO.getInt();
                long y=TextIO.getInt();
                long z=TextIO.getInt();
                if (x==0 && y==0 && z==0)
                    break;
               
                if((x*x)==(y*y)+(z*z))
                    System.out.println("right");
                else if(((y*y)==(x*x)+(z*z)))
                    System.out.println("right");
                else if(((z*z)==(x*x)+(y*y)))
                    System.out.println("right");
                else
                    System.out.println("wrong");

            }
    }
   
}

No comments:

Post a Comment