# Uva oj 113-power of cryptography (ciphertext multiplication party)

Source: Internet
Author: User

Time Limit: 3.000 seconds
Time Limit: 3.000 seconds

Background
Background

Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. work in this area has resulted in the practical use of results from number theory and other branches of mathematics once considered to be of only theoretical interest.

This problem involves the efficient computation of integer roots of numbers.

The Problem
Problem

Given an integer n ≥ 1 and an integer p ≥ 1 you are to write a program that determines, the positive nth root of P. in this problem, given such integers N and P, P will always be of the form kN for an integer k (this integer is what your program must find ).

The input
Input

The input consists of a sequence of integer pairs N and P with each integer on a line by itself. for all such pairs 1 ≤ n ≤ 200, 1 ≤ p ≤ 10101and there exists an integer k, 1 ≤ k ≤ 109 such that kN = P.

The output
Output

For each integer pair N and P the value shoshould be printed, I. e., the number k such that kN = P.

Sample Input

2
16
3
27
7
4357186184021382204544

Sample output

4
3
1234

Analysis

I was shocked when I got the answer to this question. Is it true that I can implement a large number of values?Algorithm? I first thought of the big Integer Operation, and then thought of the Newton Iteration Method. Finally, we found that the given P value does not exceed the range expressed by double ...... Let's not talk about anything.CodeRight.

Solution
` # Include <iostream> # include <math. h> using namespace STD; int main (void) {for (double dnum, dpow; CIN> dpow> dnum; cout <(INT) (POW (dnum, 1.0/dpow) + 0.5) <Endl); Return 0 ;} `
Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.