一种比较挫的写法

 /*
模拟
*/
#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的更多相关文章

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

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

随机推荐

  1. Python(2.7.6) ConfigParser - 读写配置文件

    Python 标准库的 ConfigParser 模块提供一套 API 来读取和操作配置文件. 配置文件的格式 a) 配置文件中包含一个或多个 section, 每个 section 有自己的 opt ...

  2. postgresql 将同一个字段的值组合和将多个字段的值组合

    多字段值根据连接符拼接 concat_ws(':',aaa,bbb) 单字段值根据连接符拼接 string_agg(ccc,' \r\n ') 如果要将多个字段的值拼接成一个: string_agg( ...

  3. Service的一些使用

    service服务一般主要是作为后台服务使用的,前台服务一般结合通知一起. service一般主要用作长期后台服务的,而且和Activity结合性不那么紧密, 一般如果需要频繁的更新UI主要是用Act ...

  4. windows下用过VMware安装MAC OS X苹果系统

    vmware怎么安装os x10.9?vmware 10安装mac os 10.9教程详解 来源:互联网 作者:佚名 时间:10-30 13:50:20 [大 中 小] VMWare 虚拟机可以使你在 ...

  5. NDIS小鱼防火墙之拦截指定QQ登录

    因为QQ窗口是自绘窗口,gif录制软件不能正常录制到窗口,我就截图功能把窗口显示出来. 下面我的演示,我登录2个QQ号,一个被我指定拦截,让他不能够登录.另一个却可以正常的工作..看我的COOL的演示 ...

  6. (一)问候Spring4

    第一节:Spring 简介 Spring 作者:Rod Johnson: 官方网站:http://spring.io/ 最新开发包及文档下载地址:http://repo.springsource.or ...

  7. mybatis关联查询

    场景:一个人有多个手机号,一个手机号对应一个人 CREATE TABLE test.mobile ( mid INT NOT NULL auto_increment, tel ), pid INT, ...

  8. 鸟哥笔记:linux系统日志文件介绍

    简单的说日志文件就是记录系统活动信息的几个文件,例如:何时.何地(来源ip).何人(什么服务名称).做了什么操作.换句话说就是:记录系统在什么时候由哪个进程做了什么样的行为时,发生了什么事件等. 日志 ...

  9. Sass:一种CSS预处理器语言

    http://sass-lang.com/ Sass是一种CSS预处理器语言,通过编程方式生成CSS代码.因为可编程,所以操控灵活性自由度高,方便实现一些直接编写CSS代码较困难的代码. 同时,因为S ...

  10. [可拖动DIV]刚开通博客顺便就写了点东西!

    说说我自己的思路 首先需要一个初始div div { border: 1px #333 solid; width: 200px; height: 50px; } <div id="od ...