Pages

Sunday 9 September 2012

UVA - 113-Power of Cryptography

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){
            double base=0;
            try{
            base=TextIO.getDouble();
            }catch(Exception e){
                break;
            }
            double p=TextIO.getDouble();
            System.out.println(Math.round(Math.pow(p, 1/base)));
        }
    }
}

No comments:

Post a Comment