Problem Description
Tomorrow is contest day, Are you all ready?
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.

 
Input
Input file contains multiple test case, each case
consists of a positive integer n(1<n<65536), one per line. a negative
terminates the input, and it should not to be processed.
 
Output
For each test case you should output its factor as
sample output (prime factor must come forth ascending ), there is a blank line
between outputs.
 
Sample Input
60
12
-1
 
Sample Output
Case 1.
2 2 3 1 5 1
 
 
Case 2.
2 2 3 1
 
Hint

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的更多相关文章

  1. 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 ...

  2. Atitit 数据存储视图的最佳实际best practice attilax总结

    Atitit 数据存储视图的最佳实际best practice attilax总结 1.1. 视图优点:可读性的提升1 1.2. 结论  本着可读性优先于性能的原则,面向人类编程优先于面向机器编程,应 ...

  3. The Practice of .NET Cross-Platforms

    0x01 Preface This post is mainly to share the technologies on my practice about the .NET Cross-Platf ...

  4. Exercise 24: More Practice

    puts "Let's practice everything." puts 'You\'d need to know \'bout escapes with \\ that do ...

  5. ConCurrent in Practice小记 (3)

    ConCurrent in Practice小记 (3) 高级同步技巧 Semaphore Semaphore信号量,据说是Dijkstra大神发明的.内部维护一个许可集(Permits Set),用 ...

  6. ConCurrent in Practice小记 (2)

    Java-ConCurrent2.html :first-child{margin-top:0!important}img.plugin{box-shadow:0 1px 3px rgba(0,0,0 ...

  7. ConCurrent in Practice小记 (1)

    ConCurrent in Practice小记 (1) 杂记,随书自己写的笔记: 综述问题 1.线程允许在同一个进程中的资源,包括共享内存,内存句柄,文件句柄.但是每个进程有自己的程序计数器,栈和局 ...

  8. 1.2 基础知识——关于猪皮(GP,Generic Practice)

    摘要: 这是<CMMI快乐之旅>系列文章之一.说起猪皮(GP,Generic Practice),真的让人又爱又恨,中文翻译叫通用实践.CMMI标准中每个级别包含几个PA,每个PA又包含几 ...

  9. 2015年第2本(英文第1本):《The Practice of Programming》

    2015年计划透析10本英文原著,最开始选定的第一本英文书是<Who Moved my Cheese>,可是这本书实在是太短.太简单了,总体的意思就是要顺应变化,要跳出自己的舒适区,全文不 ...

  10. 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 ...

随机推荐

  1. 借助LVS+Keepalived实现负载均衡(转)

    原文:http://www.cnblogs.com/edisonchou/p/4281978.html 一.负载均衡:必不可少的基础手段 1.1 找更多的牛来拉车吧 当前大多数的互联网系统都使用了服务 ...

  2. <转载>linux下内存泄露查找、BUG调试

    先收藏着,抽空好好看看:http://www.ibm.com/developerworks/cn/linux/l-pow-debug/ 简介 调试程序有很多方法,例如向屏幕上打印消息,使用调试器,或者 ...

  3. Ubuntu下实用命令收集 --新增 删除 环境变量

    1. 关闭防火墙: sudo ufw disable 2. 设置IPV4地址和网关: ifconfig eth0 up %s netmask %s route del default gw 192.1 ...

  4. Multimedia&Network

    [Multimedia&Network] 1.Unity3D共支持4种格式音乐文件: 2.AudioSource用于指明音频源,被绑定在一个GameObject身上.光有AudioSource ...

  5. shell输出调试信息

    [shell输出调试信息] 1.使用trap命令 trap命令用于捕获指定的信号并执行预定义的命令. 其基本的语法是: trap 'command' signal 其中signal是要捕获的信号,co ...

  6. 关于网上流传的四个原版Windows XP_SP2全面了解

    如何查看你的XP SP2是否原版?打开Windows/System32/找到EULA这个文本文档(即eula.txt):打开在最后一行:有一个EULAID:XPSP2_RM.0_PRO_RTL_CN ...

  7. Guid函数

    使用GUID函数可以得到一个不重复的序列号,但是考虑到会出现并发等一系列情况,所以建议使用时间+GUID的方法去生成一串序列号 ,一般语法如下: string str = System.Guid.Ne ...

  8. UI:基础

    App的生命周期 参考 多态的使用 // // main.m #import <Foundation/Foundation.h> #import "SingleDog.h&quo ...

  9. (剑指Offer)面试题16:反转链表

    题目: 定义一个函数,输入一个链表的头结点,反转该链表并输出反转后链表的头结点. 链表的定义如下: struct ListNode{ int val; ListNode* next; }; 思路: 反 ...

  10. 转载:div和flash层级关系问题

    转自:http://sin581.blog.163.com/blog/static/860578932012813112334404/     问题: ie下默认好像div层级没有flash层级高,也 ...