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. oracle字段由中文前缀加数字,数字自动增长的实现

    table中有一个字段,id,它是由Yunsha_000001的规则组成的. 每当插入一条数据的时候,自动生成的id是自动增加的,如何实现数字部分的自动增长? select  'Yunsha_'||l ...

  2. 猜数字游戏--基于python

    """题目:练习使用python写一个猜数字的游戏,数字范围0-100,每次猜错,需要给出缩小后的范围,每个人只有10次的猜测机会,猜测机会用完游戏结束!"&q ...

  3. 最近见到的JS返回函数的一些题

    JS返回值题一直都是考察重点,面试和笔试之中也经常涉及到,说一说我最近遇到的一些有意思的JS返回函数问题. 之前见到过一道有意思的问题,说有一个sum函数,用户可以通过sum(2,3)来取到2+3 = ...

  4. < 软件工程 第一次作业 >

    自我介绍: 老师好! 我叫李智强,专业是计算机科学与技术,我自己也喜欢这个专业,然后这是我第一次用博客写自我介绍,可能会写的有点不好,还请包涵. 课程期望和目标: 第一次上课,听着老师说我们可能会做很 ...

  5. Java中 Comparator接口 与Comparable 的区别

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt159 comparator接口与Comparable接口的区别 1. Com ...

  6. 机器学习实战之 第10章 K-Means(K-均值)聚类算法

    第 10 章 K-Means(K-均值)聚类算法 K-Means 算法 聚类是一种无监督的学习, 它将相似的对象归到一个簇中, 将不相似对象归到不同簇中.相似这一概念取决于所选择的相似度计算方法.K- ...

  7. poj3463 最短路和比最短路长1的路径数

    这题需要很好的理解Dij. 在Dij的基础上,每个点多一个次短路的长度和数量进行控制. 那么在队列中,最短路控制时出现n次,次短路控制出现n次.注意松弛条件中val值和最短路.次短路的关系. 这题需要 ...

  8. python 斐波那契数列 fibonacci

    在python中生成fibonacci数列的函数 def fibonacci(): list = [] while 1: if(len(list) < 2): list.append(1) el ...

  9. JMeter打开脚本失败 如何解决?

    最近有碰到JMeter打开之前的脚本,报错了,见下图: 后来发现这是因为之前保存脚本的 jmeter 和这次打开脚本的 jmeter 版本不一致(图一)或者版本一致而插件没有保持同步(图二)的原因: ...

  10. java伪代码《大道至简》

    阅读<大道至简>第一章,深感作者对编程问题的精炼定义,通过对古老寓言故事<愚公移山>的引用,说明了编程的本质,即顺序,分支,循环.其中又将他们扮演的项目组织者,团队经理,编程人 ...