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 ...
随机推荐
- Scene View Navigation
[Scene View Navigation] Hold the right mouse button to enter Flythrough mode. This turns your mouse ...
- OpenGL复习要点
[OpenGL要点复习] 1.和像素有关的信息(例如像素的颜色)组织成位平面 (bitplane)的形式,位平面又可以组织成帧缓冲区(framebuffer)的形式.位平面是一块内存区域,保存了屏幕上 ...
- 关于datatable的一些操作以及使用adapter对数据的操作
private void updateToolStripMenuItem_Click(object sender, EventArgs e) {//将数据更新回数据库 //获取源数据 DataTabl ...
- POJ 3254 Corn Fields (状压dp)
题目链接:http://poj.org/problem?id=3254 给你n*m的菜地,其中1是可以种菜的,而菜与菜之间不能相邻.问有多少种情况. 状压dp入门题,将可以种菜的状态用一个数的二进制表 ...
- 深入理解CRITICAL_SECTION
临界区是一种防止多个线程同时执行一个特定代码节的机制,这一主题并没有引起太多关注,因而人们未能对其深刻理解.在需要跟踪代码中的多线程处理的性能时,对 Windows 中临界区的深刻理解非常有用.本文深 ...
- php连接oracle10数据库 转载
本文转载自:http://blog.csdn.net/wzg199088/article/details/6678241 一.配置环境: 访问Oracle8以上的数据库需要用到Oracle8Call- ...
- 实现jsp网页设为首页功能
var url = location.href; var browser_name = navigator.userAgent; if(browser_name.indexOf('Chrome')!= ...
- [LeetCode] Consecutive Numbers 连续的数字 --数据库知识(mysql)
1. 题目名称 Consecutive Numbers 2 .题目地址 https://leetcode.com/problems/consecutive-numbers/ 3. 题目内容 写一个 ...
- SQLServer: 无法修改表
工具—选项—Designers—表设计器和数据库设计器—阻止保存要求重新创建表的更改前的勾去掉.
- missing artifact com.oracle:ojdbc14:jar:10.2.0.2.0解决办法
下载jar,导入到maven中 下载:http://download.csdn.net/detail/spring123tt/6991897 cmd中输入: mvn install:install-f ...