HDU4519
一种比较挫的写法
- /*
- 模拟
- */
- #include<stdio.h>
- #include<string.h>
- #include<stdlib.h>
- #include<algorithm>
- #include<iostream>
- #include<queue>
- #include<stack>
- #include<math.h>
- #include<map>
- using namespace std;
- const int maxn = ;
- int cmp( int a,int b ){
- return a>b;
- }
- int main(){
- int ca;
- scanf("%d",&ca);
- while( ca-- ){
- int n,m,k;
- scanf("%d%d%d",&n,&k,&m);
- int a[ maxn ];
- for( int i=;i<n;i++ )
- a[i] = k;
- int ans = ;
- while( ){
- sort( a,a+n,cmp );
- if( a[]<= ) break;
- for( int i=;a[i]>&&i<min(n,m);i++ )
- a[ i ]--;
- ans++;
- }
- printf("%d\n",ans);
- }
- return ;
- }
另外一种方法
- /*
- 模拟
- */
- #include<stdio.h>
- #include<string.h>
- #include<stdlib.h>
- #include<algorithm>
- #include<iostream>
- #include<queue>
- #include<stack>
- #include<math.h>
- #include<map>
- using namespace std;
- const int maxn = ;
- const double eps = 0.99999999;
- int main(){
- int ca;
- scanf("%d",&ca);
- while( ca-- ){
- int n,m,k;
- scanf("%d%d%d",&n,&k,&m);
- if( m>=n ){
- printf("%d\n",k);
- continue;
- }
- if( (n*k)%m== ) printf("%d\n",n*k/m);
- else printf("%d\n",n*k/m+);
- }
- return ;
- }
HDU4519的更多相关文章
- HDU----(4519)郑厂长系列故事——体检
郑厂长系列故事——体检 Time Limit: 500/200 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total S ...
随机推荐
- 轻松学习Ionic (一) 搭建开发环境,并创建工程
1.准备工作 下载 Node.js(下载包),WebStorm(IDE,编写代码,浏览器调试),JDK(webstorm 运行环境),Android SDK (Android编译) 不 ...
- 在线HTML编辑器 kindeditor-4.1.10 上传图片文件 应用指南
1.在ASPX页面中对应的head.body添加相应的红色部分 2.引用kindeditor-4.1.10中的litjosn.dll 3.在写入数据库时要替换相应的路径和IP 4.kindeditor ...
- Innosetup打包自动下载.net framework 动态库及替换卸载程序图标.
在使用了一段时间微软自带的安装包打包工具后,总感觉不太顺利,于是便想着找一种更简单稳定的打包工具,这类工具其实还不少,最终经过各种考量,我们选择了 InnoSetup , 该工具是一个完全免费的Win ...
- java多线程总结四:volatile、synchronized示例
1.synchronized保证同步 先看一个生成偶数的类 <span style="font-size:16px;">package demo.thread; /** ...
- Linux中Oracle数据库备份还原
一.备份Oracle数据库 1.使用数据库管理员账户登录 sqlplus system/system@orcl as sysdba; 2.创建备份目录,并指定备份目录(bak_dir)的物理路径 cr ...
- ###Linux基础 - 1
点击查看Evernote原文. #@author: gr #@date: 2014-10-11 #@email: forgerui@gmail.com 前言 为什么学习Linux?:-) 酷Cool ...
- Attribute (一)
本文导读 1.概念 2.自定义一个 Attribute 概念 Attribute是一个特殊的类,我们知道 .NET 程序集 具有自描述的特性(由于元数据),Attribute和.NET的元 ...
- SpringInAction读书笔记--第4章面向切面
1.什么是面向切面编程 在软件开发中,散布于应用中多处的功能被称为横切关注点,这些横切关注点从概念上是与应用的业务逻辑相分离的,但往往分直接嵌入到应用的业务逻辑之中,把这些横切关注点与业务逻辑相分离正 ...
- 只有PD号的调起
cicsterm-> CECI -> LI-> P -> TestQuery
- OpenJudge 2817:木棒 / Poj 1011 Sticks
1.链接地址: http://bailian.openjudge.cn/practice/2817/ http://poj.org/problem?id=1011 2.题目: 总时间限制: 1000m ...