The Last Practice
We have
been training for 45 days, and all guys must be tired.But , you are so lucky
comparing with many excellent boys who have no chance to attend the
Province-Final.
Now, your task is relaxing yourself and making the last
practice. I guess that at least there are 2 problems which are easier than this
problem.
what does this problem describe?
Give you a positive integer,
please split it to some prime numbers, and you can got it through sample input
and sample output.
consists of a positive integer n(1<n<65536), one per line. a negative
terminates the input, and it should not to be processed.
sample output (prime factor must come forth ascending ), there is a blank line
between outputs.
60=2^2*3^1*5^1
#include <stdio.h>
#include <string.h> int main(){
int number;
int i;
int amount[];
int temp;
int time; time=; while(){
scanf("%d",&number); if(number<)
break; if(time!=)
printf("\n"); memset(amount,,*sizeof(int));
temp=number; while(){
for(i=;i<=temp;i++){
if(temp%i==){
amount[i]++;
temp/=i;
break;
} } if(temp==)
break;
} printf("Case %d.\n",time);
time++; for(i=;i<=number;i++){
if(amount[i]!=){
printf("%d %d ",i,amount[i]);
}
} printf("\n");
} return ;
}
The Last Practice的更多相关文章
- Pramp mock interview (4th practice): Matrix Spiral Print
March 16, 2016 Problem statement:Given a 2D array (matrix) named M, print all items of M in a spiral ...
- Atitit 数据存储视图的最佳实际best practice attilax总结
Atitit 数据存储视图的最佳实际best practice attilax总结 1.1. 视图优点:可读性的提升1 1.2. 结论 本着可读性优先于性能的原则,面向人类编程优先于面向机器编程,应 ...
- The Practice of .NET Cross-Platforms
0x01 Preface This post is mainly to share the technologies on my practice about the .NET Cross-Platf ...
- Exercise 24: More Practice
puts "Let's practice everything." puts 'You\'d need to know \'bout escapes with \\ that do ...
- ConCurrent in Practice小记 (3)
ConCurrent in Practice小记 (3) 高级同步技巧 Semaphore Semaphore信号量,据说是Dijkstra大神发明的.内部维护一个许可集(Permits Set),用 ...
- ConCurrent in Practice小记 (2)
Java-ConCurrent2.html :first-child{margin-top:0!important}img.plugin{box-shadow:0 1px 3px rgba(0,0,0 ...
- ConCurrent in Practice小记 (1)
ConCurrent in Practice小记 (1) 杂记,随书自己写的笔记: 综述问题 1.线程允许在同一个进程中的资源,包括共享内存,内存句柄,文件句柄.但是每个进程有自己的程序计数器,栈和局 ...
- 1.2 基础知识——关于猪皮(GP,Generic Practice)
摘要: 这是<CMMI快乐之旅>系列文章之一.说起猪皮(GP,Generic Practice),真的让人又爱又恨,中文翻译叫通用实践.CMMI标准中每个级别包含几个PA,每个PA又包含几 ...
- 2015年第2本(英文第1本):《The Practice of Programming》
2015年计划透析10本英文原著,最开始选定的第一本英文书是<Who Moved my Cheese>,可是这本书实在是太短.太简单了,总体的意思就是要顺应变化,要跳出自己的舒适区,全文不 ...
- Java Concurrency In Practice -Chapter 2 Thread Safety
Writing thread-safe code is managing access to state and in particular to shared, mutable state. Obj ...
随机推荐
- Dagger2 scope
1. 一个没有scope的component是不能依赖于另外一个有scope的component 2.@Singleton不是真正意义的单例,比如下面 @Singleton @Component cl ...
- hdu 5475 An easy problem(暴力 || 线段树区间单点更新)
http://acm.hdu.edu.cn/showproblem.php?pid=5475 An easy problem Time Limit: 8000/5000 MS (Java/Others ...
- DELPHI7在WIN8和WIN10下安装和运行
DELPHI7在WIN8下安装后可以打开运行,但发现设置断点DEBUG运行DLL工程时会卡死(IDE长时间无反应,不报错). DELPHI7在WIN10下安装后打开的时候会报错,无法运行. 以上两种情 ...
- ado通用操作数据单元
DELPHI开发2层C/S数据库应用程序,许多人通过ADOQUERY或ADOTABLE直接操作数据库,其实这种方法虽然最为直接,但有其缺点:如果以后要将程序升级为3层C/S会非常困难.而通过像下面的通 ...
- ASP.NET前台AJAX方法调用后台的方法写法
前台: <input id="AjaxDemo" type="button" onclick="get()" value=" ...
- 前端MVC学习总结(三)——AngularJS服务、路由、内置API、jQueryLite
一.服务 AngularJS功能最基本的组件之一是服务(Service).服务为你的应用提供基于任务的功能.服务可以被视为重复使用的执行一个或多个相关任务的代码块. AngularJS服务是单例对象, ...
- Jupyter增加内核
本例的Jupyter安装在Python3下,以增加Python2内核为例. 首先确认在Python3下已安装了内核: ipython kernel install --user #or python3 ...
- Java集合框架(JCF)之collention
一.概念:是为了实现某一目的或功能而预先提供的一系列封装好了的具有继承或实现的类与接口. 二.特点: 1.元素的类型可以不同 2.集合长度可变 3.空间不固定 三.collection与collec ...
- 用Java实现菱形的打印输出
import java.util.Scanner; public class dengyao2 { public dengyao2() { super(); } public static void ...
- JS瀑布流布局模式(1)
在实际的项目中,偶尔会用到一种布局——瀑布流布局.瀑布流布局的特点是,在多列布局时,可以保证内容区块在水平方向上不产生大的空隙,类似瀑布的效果.简单的说,在垂直列表里,内容区块是一个挨着一个的.当内容 ...