FOJ 1075
#include<stdio.h>
#include<iostream>
using namespace std;
int a[]={,};
int hash[]={};
void func()
{
int i,j,k=,flag;
hash[]=hash[]=;
for(i=;k<;i+=)
{
flag=;
for(j=;a[j]*a[j]<i;j++)
{
if(i%a[j]==)
{
flag=;
break;
}
}
if(flag)
{
a[k++]=i;
hash[i]=;
}
}
}
int main()
{
func();
//printf("%d\n",a[6990]);
int n;
scanf("%d",&n);
while(n--)
{
int p=;
scanf("%d",&p);
while(hash[p]==)
{
for(int j=;j<&&p>=a[j];j++)
{
while(p%a[j]==&&hash[p]==)
{
printf("%d*",a[j]);
p=p/a[j];
}
}
}
printf("%d\n",p);
}
return ;
}
FOJ 1075的更多相关文章
- ural 1075. Thread in a Space
1075. Thread in a Space Time limit: 1.0 secondMemory limit: 64 MB There are three points in a 3-dime ...
- HDOJ 1075
字典树 9890974 2013-12-25 15:31:06 Accepted 1075 468MS 59832K 1342 B G++ 泽泽 #include<stdio.h> #in ...
- HDU 1075 What Are You Talking About(Trie的应用)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K ...
- hdu 1075 (map)
http://acm.hdu.edu.cn/showproblem.php?pid=1075 What Are You Talking About Time Limit: 10000/5000 MS ...
- Problem 2020 组合(FOJ)
Problem 2020 组合 Accept: 714 Submit: 1724Time Limit: 1000 mSec Memory Limit : 32768 KB Problem ...
- wikioi 1075 明明的随机数
/*============================================================ 1075 明明的随机数 题目描述 Description 明明想在学校中请 ...
- hdu 1075 What Are You Talking About
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 题意:比较简单,易懂,这里不做说明. 解法:第一种方法:用map映射,耗时1000+ms:第二种 ...
- PAT 1075. PAT Judge (25)
题目地址:http://pat.zju.edu.cn/contests/pat-a-practise/1075 此题主要考察细节的处理,和对于题目要求的正确理解,另外就是相同的总分相同的排名的处理一定 ...
- FZU OJ 1075 :分解素因子
Problem 1075 分解素因子 Accept: 2161 Submit: 4126Time Limit: 1000 mSec Memory Limit : 32768 KB Pro ...
随机推荐
- javascript基础知识拾遗
1 下面列出的值被当作假 false null undefined '' 0 NaN 其它所有值被当作是真 console.log(undefined || true); //true console ...
- javascript继承(二)—创建对象的三种模式
一.工厂模式 function createPerson(name,age){ var o = {}; o.name = name; o.age = age; o.sayHi = function() ...
- 每天一个linux命令(16):whereis 命令
whereis命令只能用于程序名的搜索,而且只搜索二进制文件(参数-b).man说明文件(参数-m)和源代码文件(参数-s).如果省略参数,则返回所有信息. 和 find相比,whereis查找的速度 ...
- WeakHashMap和HashMap的区别
看Java源码的时候,看到了 WeakHashMap ,我一直以来使用的 都是 HashMap,于是查了一下两者的区别 (一) 查看API文档,WeakHashmap要点如下: 1. 以弱键 实现的基 ...
- C语言中访问结构体成员时用‘.’和‘->’的区别
举个例子,定义了一个叫Student,别名为stu的结构类型,我们声明了一个结构体变量叫stu1,声明了一个结构体指针为stuP. typedef struct Student { char name ...
- 【CodeForces 621A】Wet Shark and Odd and Even
题 Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wan ...
- 积木(DP)问题
问题:Do you remember our children time? When we are children, we are interesting in almost everything ...
- BZOJ-3229 石子合并 GarsiaWachs算法
经典DP?稳T 3229: [Sdoi2008]石子合并 Time Limit: 3 Sec Memory Limit: 128 MB Submit: 426 Solved: 202 [Submit] ...
- codevs1064 虫食算
题目描述 Description 所谓虫食算,就是原先的算式中有一部分被虫子啃掉了,需要我们根据剩下的数字来判定被啃掉的字母.来看一个简单的例子: 43#9865#045 + 8468#6 ...
- UVA 1398 Meteor
传送门 Solution: 记一颗流星在视野内的时间段为(L, R), 为了使所有(L, R)都取整数,首先将坐标放大. 放大倍数可取为 LCM(1, 2, ..., 10)= 2520 接着计算:从 ...