Thursday, 20 February 2014

UVA Problem ID 113 (Power of Cryptography)

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
	public static void main(String[] args) throws IOException 
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder("");
        String input;
        while((input=br.readLine())!=null)
        {  	
        	int n=Integer.parseInt(input);
        	double p=Double.parseDouble(br.readLine());
        	sb.append(Math.round(Math.pow(p,(double)1/n)));
        	sb.append("\n");
        }
        System.out.print(sb);
    }
}

Previous Post
Next Post

0 comments:

Advertisement