博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu2021 11页水题
阅读量:7061 次
发布时间:2019-06-28

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

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2021
暴力出解,可能数多了就不行了
题解:
#include
#include
#include
#include
#include
using namespace std;int a[6]={
100,50,10,5,2,1};int num(int x){ int sum=0; for(int i = 0;i< 6;i++) { int t = x/a[i]; sum+=t; x = x- t*a[i]; } return sum; }int main(){ int n,a; while(cin>>n) { if(n==0) break; int count = 0; for(int i = 0;i< n;i++) { cin>>a; count+=num(a); } cout<
<
View Code

 

转载于:https://www.cnblogs.com/lyqf/p/9737889.html

你可能感兴趣的文章
js call
查看>>
【原】Java学习笔记024 - 包装类
查看>>
如何写一手漂亮的 Vue
查看>>
2018.10.29-dtoj-3999-游戏(game)
查看>>
LNOI2019 游记
查看>>
php简单实现MVC
查看>>
json和jsonp的区别(转)
查看>>
轮播图
查看>>
我们为什么要当程序员?
查看>>
Bootstrap3系列:按钮组
查看>>
React笔记:组件(3)
查看>>
tomcat与jboss 01
查看>>
【记录一个问题】linux + opencv + gpu视频解码,好不容易编译通过,运行又coredump了...
查看>>
问题总结
查看>>
testNG框架,使用@BeforeClass标注的代码,执行失败不抛出异常,只提示test ignore的解决方法...
查看>>
[C++基础]020_C++0x新特性之右值引用(int&& value)
查看>>
java高并发之CountDownLatch,CyclicBarrier和join
查看>>
【简易版】IOS仿periscope自制狂赞飘桃心
查看>>
xss其他标签下的js用法总结大全
查看>>
《图像处理实例》 之 寻找图纸标注
查看>>