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 ...
随机推荐
- 解决 SQL Server Profiler 跟踪[不断]出现检索数据
问题简单回顾: 当我们使用SQL Server Profiler根据数据时,有时刚打开什么也没干呢,就显示很多数据了,当我们用橡皮擦清除,没过两秒就又有了,如图: 是不是很恼火!~不怕,解决方案如下: ...
- OC基础--成员变量的封装
一.封装的作用: 1.重用 2.不必关心具体的实现 3.面向对象三大特征之一 4.具有安全性 二.OC中成员变量的命名规范以及注意事项 1.命名规范--.成员变量都以下划线“_”开头 1)为了跟get ...
- 判断Set里的元素是否重复、==、equals、hashCode方法研究-代码演示
被测试类,没有重写hasCode()和equals()方法: package niukewang; import java.util.Objects; public class setClass { ...
- 【前端学习】git命令行界面
学习目标:掌握git命令行界面的操作.掌握最基本的clone add commit push pull操作. 先下载客户端:http://github-windows.s3.amazonaws.com ...
- Mac OS X系统下编译运行C代码
1.使用编译器将源文件中的代码转换为二进制代码,这个过程叫做编译. 将终端的工作路径切换到源文件所在的路径. cc -c 源文件的名称.例如:cc -c main.c 如果没有意外的话,就会在当前工作 ...
- spring - ioc和aop
1.程序中为什么会用到spring的ioc和aop 2.什么是IOC,AOP,以及使用它们的好处,即详细回答了第一个问题 3.原理 关于1: a:我们平常使用对象的时候,一般都是直接使用关键字类new ...
- 洛谷P1263 || 巴蜀2311 宫廷守卫
题目描述 从前有一个王国,这个王国的城堡是一个矩形,被分为M×N个方格.一些方格是墙,而另一些是空地.这个王国的国王在城堡里设了一些陷阱,每个陷阱占据一块空地. 一天,国王决定在城堡里布置守卫,他希望 ...
- js中按钮控制显示隐藏以及下拉功能
<script> function show() { var a2=document.getElementById("div2"); if(a2.style.displ ...
- Fedora 20下配置samba服务器
1 安装samba [root@localhost ~]# yum –y install samba ← 通过网络安装samba yum -y install samba-client // ...
- iOS欢迎界面Launch Screen动态加载广告
有许多应用程序在打开的时候,欢迎界面会加载一张连网获取的广告图片或者显示一组动画,这样的效果是如何做到的呢?下面给大家介绍一种简单的实现加载广告的方式. 程序运行起来,欢迎界面之后,会进入AppDel ...