HDU 1405 The Last Practice【注意输出格式】
来源:互联网 发布:php错误日志在哪 编辑:程序博客网 时间:2024/06/05 11:14
/*
中文题目 最后的练习
中文翻译-大意 举例说明60%2==0;60/2==30;30%2==0;30/2==15;15%2!=0;15%3==0;15/3==5;5%3!=0;5%5==0;根据例子可以看出60的质子含有2^2, 3^1, 5^1,按样例输出2【】2【】3【】1【】5【】1【】。
解题思路:先打一个素数表,在直接求解就可以了
注意:除第一个数据外,其余输入后要空行;输出格式坑人啊。
关键点:输出格式
解题人:lingnichong
解题时间:2014-08-29 00:33:47
解题体会:没看清题意,凭着感觉写输出,结果oj好不客气的给我个PE
*/
The Last Practice
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7919 Accepted Submission(s): 1627
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.
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
Author
lcy
Source
杭电ACM集训队训练赛(IV)
/*本题注意格式为如下 60Case 1.2 2 3 1 5 112Case 2.2 2 3 112Case 3.2 2 3 1-1--------------------------------Process exited with return value 0Press any key to continue . . .*/#include<stdio.h>#include<string.h>#define MAXN 65536+10int a[MAXN],b[MAXN];int main(){int n,i,j,k=0,t=1;memset(a,0,sizeof(a));memset(b,0,sizeof(b));a[0]=a[1]=-1;for(i=2;i<MAXN/2;i++){for(j=2*i;j<MAXN;j+=i)if(a[j] != -1)a[j] = -1;}for(i=0;i<MAXN;i++){if(a[i]==0)b[k++] = i;}while(scanf("%d",&n),(n>=0)){if(t>1)printf("\n");printf("Case %d.\n",t++);for(i = 0; i <= n/2; i++){int count=0,flag=0;while(n%b[i]==0){count++;n /= b[i];flag=1;}if(flag==1)printf("%d %d ",b[i],count);}printf("\n");}return 0;}
0 0
- HDU 1405 The Last Practice【注意输出格式】
- HDU 1405 The Last Practice(数学题,变态的格式)
- hdu 1405 The Last Practice
- The Last Practice hdu 1405
- HDU 1405 The Last Practice
- HDU 1405The Last Practice
- HDU 1405 The Last Practice
- HDU 1405 The Last Practice
- HDU The Last Practice
- hdu 1405 The Last Practice (数学)
- hdu-oj 1405 The Last Practice
- HDU 1405 The Last Practice(暴力枚举)
- HDU 1405 The Last Practice
- hdu 1405 The Last Practice 数论水题
- HDU 1405 The Last Practice 数学水题
- HDU 1405 坑爹的The Last Practice
- 杭电 HDU ACM 1405 The Last Practice
- HDU——1405The Last Practice(试手map)
- TCP、UDP和HTTP
- 计算机系统要素:第六章 Part1 汇编编译器(nonsymbol)
- 技术帖:如何在高强度的工作、学习环境中健康、快乐、有效率地生活--健康篇
- ASP.NET中url传递中文的解决方案
- Houdini 导出.ass文件
- HDU 1405 The Last Practice【注意输出格式】
- python 读文件
- NYOJ 题目104最大和(动态规划)
- 某在营业店铺所用后台服务器出现SQL服务器无法启动,百度搜索后得以解决
- 计算机系统要素:第六章 Part2 汇编编译器(symbol)
- 开博啦~
- Total width of element (including padding and border) in jQuery
- ZOJ--3631--Watashi's BG【枚举】
- C++设计模式之工厂方法模式