一种比较挫的写法

  1. /*
  2. 模拟
  3. */
  4. #include<stdio.h>
  5. #include<string.h>
  6. #include<stdlib.h>
  7. #include<algorithm>
  8. #include<iostream>
  9. #include<queue>
  10. #include<stack>
  11. #include<math.h>
  12. #include<map>
  13. using namespace std;
  14. const int maxn = ;
  15.  
  16. int cmp( int a,int b ){
  17. return a>b;
  18. }
  19.  
  20. int main(){
  21. int ca;
  22. scanf("%d",&ca);
  23. while( ca-- ){
  24. int n,m,k;
  25. scanf("%d%d%d",&n,&k,&m);
  26. int a[ maxn ];
  27. for( int i=;i<n;i++ )
  28. a[i] = k;
  29. int ans = ;
  30. while( ){
  31. sort( a,a+n,cmp );
  32. if( a[]<= ) break;
  33. for( int i=;a[i]>&&i<min(n,m);i++ )
  34. a[ i ]--;
  35. ans++;
  36. }
  37. printf("%d\n",ans);
  38. }
  39. return ;
  40. }

另外一种方法

  1. /*
  2. 模拟
  3. */
  4. #include<stdio.h>
  5. #include<string.h>
  6. #include<stdlib.h>
  7. #include<algorithm>
  8. #include<iostream>
  9. #include<queue>
  10. #include<stack>
  11. #include<math.h>
  12. #include<map>
  13. using namespace std;
  14. const int maxn = ;
  15. const double eps = 0.99999999;
  16.  
  17. int main(){
  18. int ca;
  19. scanf("%d",&ca);
  20. while( ca-- ){
  21. int n,m,k;
  22. scanf("%d%d%d",&n,&k,&m);
  23. if( m>=n ){
  24. printf("%d\n",k);
  25. continue;
  26. }
  27. if( (n*k)%m== ) printf("%d\n",n*k/m);
  28. else printf("%d\n",n*k/m+);
  29. }
  30. return ;
  31. }

HDU4519的更多相关文章

  1. HDU----(4519)郑厂长系列故事——体检

    郑厂长系列故事——体检 Time Limit: 500/200 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total S ...

随机推荐

  1. 轻松学习Ionic (一) 搭建开发环境,并创建工程

    1.准备工作     下载 Node.js(下载包),WebStorm(IDE,编写代码,浏览器调试),JDK(webstorm 运行环境),Android SDK (Android编译)     不 ...

  2. 在线HTML编辑器 kindeditor-4.1.10 上传图片文件 应用指南

    1.在ASPX页面中对应的head.body添加相应的红色部分 2.引用kindeditor-4.1.10中的litjosn.dll 3.在写入数据库时要替换相应的路径和IP 4.kindeditor ...

  3. Innosetup打包自动下载.net framework 动态库及替换卸载程序图标.

    在使用了一段时间微软自带的安装包打包工具后,总感觉不太顺利,于是便想着找一种更简单稳定的打包工具,这类工具其实还不少,最终经过各种考量,我们选择了 InnoSetup , 该工具是一个完全免费的Win ...

  4. java多线程总结四:volatile、synchronized示例

    1.synchronized保证同步 先看一个生成偶数的类 <span style="font-size:16px;">package demo.thread; /** ...

  5. Linux中Oracle数据库备份还原

    一.备份Oracle数据库 1.使用数据库管理员账户登录 sqlplus system/system@orcl as sysdba; 2.创建备份目录,并指定备份目录(bak_dir)的物理路径 cr ...

  6. ###Linux基础 - 1

    点击查看Evernote原文. #@author: gr #@date: 2014-10-11 #@email: forgerui@gmail.com 前言 为什么学习Linux?:-) 酷Cool ...

  7. Attribute (一)

    本文导读 1.概念 2.自定义一个 Attribute 概念       Attribute是一个特殊的类,我们知道 .NET 程序集 具有自描述的特性(由于元数据),Attribute和.NET的元 ...

  8. SpringInAction读书笔记--第4章面向切面

    1.什么是面向切面编程 在软件开发中,散布于应用中多处的功能被称为横切关注点,这些横切关注点从概念上是与应用的业务逻辑相分离的,但往往分直接嵌入到应用的业务逻辑之中,把这些横切关注点与业务逻辑相分离正 ...

  9. 只有PD号的调起

    cicsterm-> CECI -> LI-> P -> TestQuery

  10. OpenJudge 2817:木棒 / Poj 1011 Sticks

    1.链接地址: http://bailian.openjudge.cn/practice/2817/ http://poj.org/problem?id=1011 2.题目: 总时间限制: 1000m ...