Time Limit: 1000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu

[Submit]   [Go Back]   [Status]

Description

 

A

The Super Powers

 

We all know the Super Powers of this world and how they manage to get advantages in political warfare or even in other sectors. But this is not a political platform and so we will talk about a different kind of super powers – “The Super Power Numbers”. A positive number is said to be super power when it is the power of at least two different positive integers. For example 64 is a super power as 64 = 82 and 64 =  43. You have to write a program that lists all super powers within 1 and 264 -1 (inclusive).

Input
This program has no input.

Output

Print all the Super Power Numbers within 1 and 2^64 -1. Each line contains a single super power number and the numbers are printed in ascending order.

Sample Input                              

Partial Judge Output

No input for this problem

 

1

16
64

81
256

512
.
.
.

 #include<stdio.h>
#include<string.h>
#include<set>
#include<math.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll unsigned long long
int a[]= {},nu;
void init()
{
int i,j;
nu=;
for(i=; i<; i++)
{
if(!a[i])
{
j=i*i;
while(j<)
{
a[j]=;
j+=i;
}
}
}
j=;
for(i=; i<; i++)if(a[i])a[j++]=i;
//for(i=0; i<j; i++)cout<<a[i]<<endl;
nu=j;
}
ll powLL(ll x, ll y)
{
ll ans=;
while(y)
{
if(y&)
ans*=x;
x*=x;
y>>=;
}
return ans;
}
int main()
{
init();
int i,j,size;
ll maxa=~0ULL,n;
//cout<<maxa<<endl;
set<ll>aa;
aa.clear();
aa.insert();
for(i=;;i++)
{
size=;
n=maxa;
while(n>=i) n/=i,size++;
if(size<) break;
for(j=;j<nu;j++)
{
if(a[j]<=size)
aa.insert(powLL(i, a[j]));
else break;
}
}
for(set<ll>::iterator it=aa.begin();it!=aa.end();it++)
printf("%llu\n",*it);
}

The Super Powers的更多相关文章

  1. The Super Powers UVA 11752 分析分析 求无符号长整形以内的数满足至少可以用两种不同的次方来表示。比如64 = 2^6 = 8^2; 一个数的1次方不算数。

    /** 题目:The Super Powers UVA 11752 链接:https://vjudge.net/contest/154246#problem/Y 题意:求无符号长整形以内的数满足至少可 ...

  2. uva 11752 The Super Powers 素数+大数判断大小

    题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  3. UVA11752 The Super Powers

    /* UVA11752 The Super Powers https://vjudge.net/contest/153365#problem/Y 数论 注意a^n=b要用除法求,并且求得的n比实际大1 ...

  4. The Super Powers UVA - 11752

    题目大意:将范围从1~pow(2,64)-1内的super power输出.super power的定义:一个数x至少存在两种x=pow(i,k),(k!=1). 题解: 注意数据范围2的64次方-1 ...

  5. uva 11752 - The Super Powers

    这个题   任意一个数,他的幂只要不是质数则可以分解成两个数的乘   判断有没有溺出  i×i  则用最大的那个数 Max/i < i 吗 #include<iostream> #i ...

  6. UVa 11752 (素数筛选 快速幂) The Super Powers

    首先有个关键性的结论就是一个数的合数幂就是超级幂. 最小的合数是4,所以枚举底数的上限是pow(2^64, 1/4) = 2^16 = 65536 对于底数base,指数的上限就是ceil(64*lo ...

  7. UVa 11752 - The Super Powers 数学

    请看这个说明http://blog.csdn.net/u014800748/article/details/45914353 #define _CRT_SECURE_NO_WARNINGS #incl ...

  8. The Super Powers UVA - 11752(合数幂)

    题意: 求1~2^64-1之间所有的 至少是两个不同的正整数的幂的数  升序输出 一个数的合数次幂即为这样的数 找出1~2^64-1中所有数的合数次幂 用set存起来(既能防止重复 又能升序) 最后输 ...

  9. uva 11752 The Super Powers (数论+枚举)

    题意:找出1~2^64-1中 能写成至少两个数的幂形式的数,再按顺序输出 分析:只有幂是合数的数才是符合要求的.而幂不会超过64,预处理出64以内的合数. 因为最小的合数是4,所以枚举的上限是2的16 ...

随机推荐

  1. 16汇编第十讲完结Call变为函数以及指令的最后讲解

    16汇编完结Call变为函数以及指令的最后讲解 学了10天的16位汇编,这一讲就结束了,这里总结一下昨天的LOOP指令的缺陷,因为lOOP指令的缺陷,所以我们都改为下面的汇编代码使用了,自己去写,其中 ...

  2. matlab-常用函数(1)

    rng('shuffle'): matlab help文档中的解释 rng('shuffle'): seeds the random number generator based on the cur ...

  3. POJ 2449 Dijstra + A* K短路

    这题一开始的思路应该是直接从源点进行BFS搜索K短路. 但这样的复杂度在点数和K的值增大后将会变得很大. 而A*算法则构造一个h(x),在进行BFS时,每次都抛出最小的h(x)从而使汇点的出队速度加快 ...

  4. sublime text3 3143 注册码

    sublime text3  3143 注册码,可用~ Sublime Text一款具有代码高亮.语法提示.自动完成且反应快速的编辑器软件,不仅具有华丽的界面,还支持插件扩展机制.相比于难于上手的Vi ...

  5. grunt之concat、cssmin、uglify

    周末有点懒,跑去看了<智取威虎山>,手撕鬼子的神剧情节被徐老怪一条回忆线就解释过去了,牛到极致尽是这种四两拨千斤的处理方式,手撕加分,四星推荐. --------------------- ...

  6. 自制STP配置实验

    本图使用Gns模拟器 实验需求: 1.要求利用vtp实现vlan同步设置 2.要求vtp server实现备份冗余 3.创建vlan 1~10要求MLSW1 是奇数vlan主根 MLSW2 是偶数vl ...

  7. 【转】为什么选择Spring Boot作为微服务的入门级微框架

    本文为普元云计算高级工程师许二虎在普元云计算架构设计群的微课堂分享.如需加入普元新一代数字化企业云平台研发设计群参与微课堂.架构设计与讨论直播,请直接回复此公众号:"加群 姓名 公司 职位 ...

  8. 【集美大学1411_助教博客】个人作业2——英语学习APP案例分析 成绩

    个人作业2--英语学习APP案例分析,截止发稿时间全班31人,提交31,未提交0人.有一名同学已经写了作业但忘记提交了,这次给分了,但下不为例.由于助教这周有点忙,所以点评得非常不及时,请同学们见谅. ...

  9. java课程设计--WeTalk(201521123076)

    在线群聊系统 1,团队课程设计博客链接 http://www.cnblogs.com/slickghost/p/7018105.html 个人负责模块或任务说明 负责模块:总体设计及主要聊天功能实现 ...

  10. 201521123098 《Java程序设计》第12周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结多流与文件相关内容. 1. Input Stream -- 数据提供者可从其中读数据输出流:Output Stream -- 数据接 ...