hihocoder 1288

笔试第一道。。wa了好几次,也是无语。。hihocoder错了不会告诉你失败的时候的测试集,这样有时候就很烦。。

遍历所有的字体,从min(w,h)开始逐渐变小开始遍历。。计算行数,和all行数比较,只要比他小就可以。。

我太瓜皮了。

#include <iostream>
#include<cstdio>
#include<cstring>
#include<string.h>
#include<cmath>
#include<algorithm>
using namespace std; int main()
{
int testn,n,p,w,h;
cin>>testn;
while(testn--)
{
cin>>n>>p>>w>>h;
int a[n];
for(int i=; i<n; i++)
cin>>a[i];
int up=min(w,h);
bool flag=false; for(int i=up; i>=; i--)
{
int temph=;
int allh=(h/i)*p;
for(int j=; j<n; j++)
{
temph+=a[j]/(w/i);
//这里表示开始分段了
if(a[j]%(w/i)) temph++;
}
if(temph<=allh) {cout<<i<<endl; flag=true; break;}
} if(!flag) cout<<<<endl; }
return ;
}

hihocoder 1288 : Font Size (微软2016校园招聘4月在线笔试)的更多相关文章

  1. [Hihocoder 1289] 403 Forbidden (微软2016校园招聘4月在线笔试)

    传送门 #1289 : 403 Forbidden 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi runs a web server. Someti ...

  2. 微软2016校园招聘4月在线笔试 hihocoder 1289 403 Forbidden

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描写叙述 Little Hi runs a web server. Sometimes he has to deny acces ...

  3. 微软2016校园招聘4月在线笔试 A FontSize

    题目链接:http://hihocoder.com/problemset/problem/1288 分析:题目中所求的是最大的FontSize(记为S),其应该满足P*[W/S]*[H/S] > ...

  4. 微软2016校园招聘4月在线笔试 ABC

    题目链接:http://hihocoder.com/contest/mstest2016april1/problems 第一题:输入N,P,W,H,代表有N段文字,每段有ai个字,每行有⌊W/S⌋个字 ...

  5. ACM学习历程—Hihocoder 1288 Font Size(暴力 || 二分)

    http://hihocoder.com/problemset/problem/1288 这题是这次微软笔试的第一题,关键的是s的上限是min(w, h),这样s的范围只有到1000,这样就可以直接暴 ...

  6. 微软2016校园招聘在线笔试之Magic Box

    题目1 : Magic Box 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 The circus clown Sunny has a magic box. When ...

  7. 微软2016校园招聘在线笔试-Professor Q's Software

    题目2 : Professor Q's Software 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Professor Q develops a new softw ...

  8. 微软2016校园招聘在线笔试 B Professor Q's Software [ 拓扑图dp ]

    传送门 题目2 : Professor Q's Software 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Professor Q develops a new s ...

  9. 微软2016校园招聘在线笔试 [Recruitment]

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 A company plans to recruit some new employees. There are N ca ...

随机推荐

  1. 再思linux内核在中断路径内不能睡眠/调度的原因(2010)【转】

    转自:http://blog.csdn.net/maray/article/details/5770889 Linux内核中断路径中不能睡眠,为什么? 这里就行了很深入的讨论,值得一看:http:// ...

  2. 1006. Team Rankings

    Description It's preseason and the local newspaper wants to publish a preseason ranking of the teams ...

  3. swift中闭包的循环引用

    首先我们先创造一个循环引用 var nameB:(()->())? override func viewDidLoad() { super.viewDidLoad() let bu = UIBu ...

  4. 1.ubuntu的安装

    分两种 1. 在VMware中安装,则与Centos的安装类似 2. 在VirtualBox里安装 --> 1. 先“新建” 一个虚拟电脑 2. 根据需求编辑虚拟电脑的信息 (具体的大小.内存等 ...

  5. ArcGIS Server配置端口

    写在前面,GIS服务器必须连通到外网,基于某些情况,可能一个机组有多态服务器,担任不同的角色,有Web服务器.数据库服务器和GIS服务器等,但是可能购买时只有一个外网IP,这样是不行的.JS脚本运行在 ...

  6. 获取GUID的方法

    uses QString; procedure TForm12.btn1Click(Sender: TObject); var g: TGUID; begin //方法1(Guid的Helper)-- ...

  7. maven新建web项目提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

    maven新建web项目提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bu ...

  8. resteasy web Guice集成版本

    xxxx:8080/resteasy/messageservice/aaaa Hello : aaaa web.xml <context-param> <param-name> ...

  9. mysql5.7 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    mysql5.7初次登录使用提示 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before ...

  10. spring cloud报错解决:java.lang.ClassNotFoundException: com.netflix.servo.monitor.Monitors

    见鬼的事发生了. 在家里电脑上拿样例代码,运行时OK的.但一到公司电脑,用同样的代码,就会报下面的错误 ===================== Caused by: java.lang.Class ...