博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU——1405The Last Practice(试手map)
阅读量:4611 次
发布时间:2019-06-09

本文共 1712 字,大约阅读时间需要 5 分钟。

The Last Practice

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 9185    Accepted Submission(s): 1947

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

本地编译器优化的太多也不好,一个语句分号前面多了个逗号竟然也可以编译,第一次妥妥的CE了

代码:

#include
#include
#include
#include
#include
using namespace std;int main(void){ int n,i,t=0; while (cin>>n&&n>=0) { t++; if(t!=1) cout<
list; for (i=2; i<=n; i++) { while (n%i==0) { list[i]++; n/=i; } } map
::iterator it; printf("Case %d.\n",t); for (it=list.begin(); it!=list.end(); it++) { cout<
first<<" "<
second<<" ";//这题有毒竟然不按套路出牌,最后也要有空格 } cout<

转载于:https://www.cnblogs.com/Blackops/p/5356431.html

你可能感兴趣的文章
分布式数据存储 - MySQL双主复制
查看>>
团队展示(团队)
查看>>
linux 下 jdk tar.gz 包安装方法
查看>>
【转】Spring MVC 教程,快速入门,深入分析
查看>>
【转】java枚举使用详解
查看>>
推荐两款支持在linux下运行ASP.NET网站的国产免费WEB服务器软件
查看>>
HTML入门7
查看>>
客户端检测
查看>>
年终楼市:房企主攻改善型需求购房者 中介扩店招人
查看>>
js备忘录3
查看>>
Win10下SQLServer2000的安装
查看>>
linux如何查看端口被哪个进程占用
查看>>
NFS服务器配置
查看>>
Contains Duplicate II
查看>>
让我们把KBEngine玩坏吧!如何定制我们自己的C++函数(一)
查看>>
Mongodb 3.2.8: 集群环境搭建
查看>>
函数part1——函数的使用原则
查看>>
vuex入门
查看>>
Mark Links@2012/8/15
查看>>
libevent的问题
查看>>