hd1405 The Last Practice
来源:互联网 发布:相册动画制作软件 编辑:程序博客网 时间:2024/05/17 03:16
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8891 Accepted Submission(s): 1863Problem 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.
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
6012-1
Sample Output
Case 1.2 2 3 1 5 1Case 2.2 2 3 1Hint60=2^2*3^1*5^1
提交时出现out put limit Exceeded错误,原来是a的范围搞错了a必须要大于1,而不是不等于-1.
#include<stdio.h>int main(){int i,j,k,a,b,c,s=0;while(scanf("%d",&a)&&a>1){if(s){printf("\n");}printf("Case %d.\n",++s);b=2;j=1;k=0;c=a;for(i=2;i<=c;i++){if(a%i==0){a=a/i;j=0;k++;i--;}else if(k!=0){printf("%d %d ",i,k);k=0;}}printf("\n");}return 0;}
0 0
- hd1405 The Last Practice
- HDU1405:The Last Practice
- hdu_1405 The Last Practice
- HDU1405 The Last Practice
- hdu1405 The Last Practice
- hdu1405 The Last Practice
- The Last Practice
- The Last Practice
- HDU The Last Practice
- HDU1405 The Last Practice
- hdu 1405 The Last Practice
- The Last Practice hdu 1405
- HDU 1405 The Last Practice
- 【HDOJ】1405 -> The Last Practice
- HDU 1405The Last Practice
- 杭电-The Last Practice
- HDU 1405 The Last Practice
- The Last Practice(HDU1405)
- 5个好用的混合式App开发工具
- WebService服务端与客户端开发
- ios技术博客
- tableView位置的动态改变
- Recover Binary Search Tree
- hd1405 The Last Practice
- 用Redis实现Session功能
- Tom-猫
- virtualbox增强功能-VBoxGuestAdditions安装
- 公钥 私钥 数字签名 数字证书
- x += i与x=x+i
- LeetCode之Reverse Words in a String
- 公共汽车,写一个程序,告诉司机怎么走能接到最多的乘客。
- Java修饰符关键词大全