uva 11752 - The Super Powers
这个题 任意一个数,他的幂只要不是质数则可以分解成两个数的乘 判断有没有溺出 i×i 则用最大的那个数 Max/i < i 吗
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<set>
using namespace std;
typedef unsigned long long ll;
const ll Max = 0xffffffffffffffffLL;//18446744073709551615;
set<ll>s;
bool work( int num ){
for( int i = ; i <= sqrt(num); i++ )
if( !(num%i) ) return false;
return true;
}
int main( )
{
//freopen("out1.txt","w",stdout);
s.clear(); s.insert(); set<ll>::iterator it;
for( ll i = ; i <= (<<); i++ )
{
ll ans = i*i; int num = ;
while( ){
if( Max/ans < i )break;
ans = ans*(i); num++;
if( !work(num) )s.insert(ans);
}
}
for( it = s.begin(); it != s.end(); it++ )
printf("%llu\n",*it);
return ;
}
uva 11752 - The Super Powers的更多相关文章
- uva 11752 The Super Powers 素数+大数判断大小
题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...
- UVa 11752 - The Super Powers 数学
请看这个说明http://blog.csdn.net/u014800748/article/details/45914353 #define _CRT_SECURE_NO_WARNINGS #incl ...
- uva 11752 The Super Powers (数论+枚举)
题意:找出1~2^64-1中 能写成至少两个数的幂形式的数,再按顺序输出 分析:只有幂是合数的数才是符合要求的.而幂不会超过64,预处理出64以内的合数. 因为最小的合数是4,所以枚举的上限是2的16 ...
- UVA 11752 The Super Powers —— 数学与幂
题目链接:https://vjudge.net/problem/UVA-11752 题解: 1.首先变量必须用unsig long long定义. 2.可以分析得到,当指数为合数的时候,该值合法. 3 ...
- UVA 11752 The Super Powers【超级幂】
题目链接: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=111527#problem/Z 题意: 我们称一个可以由至少两个不同正整数的幂 ...
- UVA 11752 The Super Powers(暴力)
题目:https://cn.vjudge.net/problem/UVA-11752 题解:这里只讨论处理越界的问题. 因为题目最上界是 264-1. 我们又是求次幂的. 所以当我们就可以知道 i 的 ...
- The Super Powers UVA 11752 分析分析 求无符号长整形以内的数满足至少可以用两种不同的次方来表示。比如64 = 2^6 = 8^2; 一个数的1次方不算数。
/** 题目:The Super Powers UVA 11752 链接:https://vjudge.net/contest/154246#problem/Y 题意:求无符号长整形以内的数满足至少可 ...
- UVA 10622 - Perfect P-th Powers(数论)
UVA 10622 - Perfect P-th Powers 题目链接 题意:求n转化为b^p最大的p值 思路:对n分解质因子,然后取全部质因子个数的gcd就是答案,可是这题有个坑啊.就是输入的能够 ...
- The Super Powers
The Super Powers Time Limit: 1000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu [Subm ...
随机推荐
- Javascript实现 图片的无缝滚动
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- 从idea到ipo
**************************************************************************************************** ...
- 欧拉工程第53题:Combinatoric selections
package projecteuler51to60; class p53{ void solve1(){ int count=0; int Max=1000000; int[][] table=ne ...
- hdu 4223
暴力: Problem : ( Dynamic Programming? ) Judge Status : Accepted RunId : Language : C++ Author : yudun ...
- 创业者拿到融资别高兴太早,当心TS中的优先清算权
最近创投圈的新闻读起来真是让人有些绝望啊,一家家创业公司接连宣告倒闭,其中不乏一些走在比较后面的“明星企业”,冷不丁冒出点消息,却是创始人发的公告,宣布公司资金链断裂,进入破产清算程序,或被低价并购. ...
- MAC的一些实用
重置Dock, Launchpad defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock;
- ubuntu common
系统信息 # uname -a # 查看内核/操作系统/CPU信息 # cat /etc/issue # 查看操作系统版本 #cat /proc/version ...
- Python ->> 第一个Python程序
#coding:utf-8 #print 'input your name, please' #name = raw_input('请输入你的名字:'.decode('utf-8').encode(' ...
- [转载]TexturePacker 如何使用自带的加密功能及在cocos2dx中的使用
在cocos2dx中使用纹理图集是非常节省资源的,在这里推荐 TexturePacker,而且 TexturePacker工具的加密接口也非常的好用,下面就来介绍一下... TexturePacker ...
- Algorithm: cartesian tree
http://baike.baidu.com/link?url=XUt5fXQ-jtFBM0UdKiGA41_NWFvdFSYwVsy4SVvCRRuEBvNkLfT9TgOtzsXvaOT9nuq_ ...