UVA 113 - Power of Cryptography(数学)

POJ2109-Power of Cryptography 北大POJ2109-Power of Cryptography 解题报告+AC代码 立即下载

Power of Cryptography 

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

Given an integer tex2html_wrap_inline32 and an integer tex2html_wrap_inline34 you are to write a program that determines tex2html_wrap_inline36 , the positive tex2html_wrap_inline38 root of p. In this problem, given such integers n and p, p will always be of the form tex2html_wrap_inline48 for an integer k (this integer is what your program must find).

The 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 tex2html_wrap_inline56 ,tex2html_wrap_inline58 and there exists an integer k, tex2html_wrap_inline62 such that tex2html_wrap_inline64 .

The Output

For each integer pair n and p the value tex2html_wrap_inline36 should be printed, i.e., the number k such that tex2html_wrap_inline64 .

Sample Input

2
16
3
27
7
4357186184021382204544

Sample Output

4
3
1234

=====================================

这道题意外的简单啊……不过不知道这么写会不会有什么问题……总之是A了……

注意输出的时候要加 .0


#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main()
{
    double n,p;
    while(cin>>n>>p)
    {
        printf("%.0lf\n",pow(p,1/n));
    }
    return 0;
}


相关推荐

大疆智图002:大疆智图倾斜摄影建模流程

本文主要介绍大疆智图倾斜摄影建模流程,包括新建工程、成果路径设置、导入照片、第一遍空三、像控刺点、第二遍空三、精度报告查看、三维重建等流程。

qq_31762031的博客 1万+

POJ 2109 Power of Cryptography

Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these prim

异リ度ュ空ウ間(镜像站) 854

【Cadence】stb仿真和ac仿真——以一个简单的全差分反相放大器仿真为例

最近在补一些仿真方法学的问题,以及一些一直以来都有点模糊的概念,简单记录一下。搭建一个以两个CMOS反相器构成的全差分放大器(28nm工艺,PMOS和NMOS尺寸一致)激励的设置方便共模和差模仿真用同一个TB(这里有一个问题:这个放大器需要在开环下仿真还是闭环下?哪些放大器应用在开环,哪些闭环?这种应用场景不同会导致需要仿真得到开环还是闭环增益,或者环路增益?(我知道放大器在设计的时候肯定都是闭环应用的多,但是什么时候没必要闭环应用?光验证ac和stb仿真是否一样的话有必要有回路吗?

weixin_44951108的博客 5万+

Power of Cryptography

//只用一行核心代码就可以过的天坑题目............= = 题目: Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in thi...

weixin_30483697的博客 104

自动驾驶IDM与MOBIL模型

IDM模型,自动驾驶

不想学好数学的汽车工程师不是一个好的程序员 1万+

PaddleOCR 3.x 最新版使用教程(2025)——从安装到实战身份证识别,一步到位!

本文针对PaddleOCR 3.x大版本更新带来的参数变化和兼容性问题,提供从环境配置到实际应用的全流程解决方案。

qq_58607032的博客 9787

贪心——Power of Cryptography

Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 18080   Accepted: 9124 Description Current work in cryptography involves (among other t

空白页 639

VBA常见错误 - “错误3706,未找到提供程序,该程序可能未正确安装”解决方法

1、问题描述 在利用VBA编程时,引用其它表格数据,出现以下问题: (1)运行“错误3706,未找到提供程序,该程序可能未正确安装”。 (2)引用数据失败 2、解决方法 下载“Access 2010 数据库引擎”,并安装即可。 https://www.microsoft.com/en-us/download/details.aspx?id=54920 AccessDatabaseEngine 2010 官方安装包,官网下载不了的可以来这里下载。(1)运行“错误3706,未找到提..

Nemuel的博客 3万+

Power of Cryptography(数论)

Table of Contents 题目大意:已知公式 k^n =p, 输入 n 与 p 求解 k 的值并输出解题思路:k = p ^ (1/n), 注意数据范围即可 Description Current work in cryptography involves (among other things) large prime numbers and computing power...

与恶龙缠斗良久终成恶龙 432

AUTOSAR OS演示项目搭建与验证

请注意,以上代码只是一个简单的示例,用于说明AUTOSAR OS项目的搭建和验证过程。此外,AUTOSAR OS还提供了其他功能和API,如事件、消息队列和任务间通信等,可以根据实际需求进行使用。AUTOSAR OS是AUTOSAR架构中的一部分,它提供了一种可移植且可扩展的操作系统,用于管理嵌入式应用程序的任务和资源。通过以上步骤,我们成功搭建了一个基于AUTOSAR OS的演示项目,并验证了应用程序任务的执行顺序。3、打开app.c文件,并编写一个简单的应用程序,作为我们的示例任务。

weixin_50547796的博客 195

[网络安全自学篇] 六十八.WannaCry勒索病毒复现及分析(二)MS17-010利用及病毒解析

这是作者的网络安全自学教程系列,主要是关于安全工具和实践操作的在线笔记,特分享出来与博友们学习,希望您们喜欢,一起进步。前文分享了通过Python利用永恒之蓝漏洞加载WannaCry勒索病毒,并实现对Win7文件加密的过程,但过程较为复杂,为什么不直接利用永恒之蓝呢?所以,这篇文章将直接分享MSF利用MS17-010漏洞进行反弹Shell,再上传勒索病毒进行实验复现,并详细讲解WannaCry勒索病毒的原理。基础性文章,希望对您有所帮助。

杨秀璋的专栏 1万+

POJ-2109 Power of Cryptography

Power of Cryptography 原题链接 Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 26641 Accepted: 13309 Description Current work in cryptography involves (among other things) larg...

xu0_zy的博客 342

【STM32Cube_14】使用硬件I2C读写环境光强度传感器(BH1750)

本篇详细的记录了如何使用STM32CubeMX配置STM32L431RCT6的硬件I2C外设读取环境光强度传感器数据(BH1750)

Mculover666的博客(嵌入式) 7242

UVA 113 Power of Cryptography (数学)

Power of Cryptography Background Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. ...

weixin_34214500的博客 195

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

UVA 113-Power of Cryptography 数学水题

本题题意为给一个n,一个p,求k,使得k的n次方等于p,由于

加油吧~Araleii 497

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

POJ2109 ZOJ2486 UVA113 UVALive3098 Power of Cryptography【数学】

Power of CryptographyTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 26661 Accepted: 13325DescriptionCurrent work in cryptography involves (among other things) large prime numbers and comput...

海岛Blog 638

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

UVA 113 (暑假-数学-A - Power of Cryptography)

Power of Cryptography  Background Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in t

Bingo 1551

UVA-113 Power of Cryptography

2016-07-20 UVA-113 Power of Cryptography 题目大意:k^n=p,给出 n 和 p 求 k 解题思路:k = p ^ (1/n) 注意:这题用double即可,原因如下。 此题可用double的原因 #include #include #include using namespace std; int main()

振丿Love 423

UVA 113 Power of Cryptography

UVA-113 Power of Cryptography题目大意:1 <= n <= 200, 1 <= p <= 10^101, k^n = p, 已知 n, p, 求 k。Sample Input 2 16 3 27 7 4357186184021382204544Sample Output 4 3 1234解题思路:这个题思路是先求1+2+3+……+n>k的最小n,然后判

Tochase的博客 359

UVa 113 Power of Cryptography

本文探讨了求解整数n次根的三种方法。题目要求计算满足k^n=p的整数k,其中p可能极大(10^101)。方法一采用高精度运算和二分查找,通用但复杂;方法二利用double类型进行二分查找,简洁高效;方法三直接使用pow函数计算p^(1/n),最为简便。分析表明,在题目限定范围内,后两种方法依赖浮点数精度仍能正确求解,而方法一虽可靠但效率较低。根据具体需求可选择不同实现方案。

寂静山林 599

113 - Power of Cryptography

Uva 113 - Power of Cryptography  Power of Cryptography  Background Current work in cryptography involves (among other things) large prime numbers and computing powers o

foolbird 551

UVA 113 Power of Cryptography

YIYI:  k  ^ n = p; 求k? 原先不知道该用什么类型来存数据,百度下发现double就够存了。 Description Background Current work in cryptography involves (among other things) large prime numbers and computing powers of numbe

哈希的博客 367

Uva 113 Power of Cryptography

Power of Cryptography  Background Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in t

小G的ACM之路 793

A - Power of Cryptography uva113

A - Power of Cryptography uva113Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 113 Appoint description: Background Current work in cryptography i

qwesde 1077
上一篇: UVA 10494 - If We Were a Child Again(大数除法和取模)
下一篇: UVA 10161 - Ant on a Chessboard(数学)
coco430
博客等级 码龄14年 9粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值