称号:放置在一个圆中的矩形,它要求每个圆的每行或列是切线,问:多少能竖起来。

分析:计算几何。数论。首先计算矩形显示屏,然后计算互显示器(每一行与相邻行相同差1个月)求最大,你可以。

说明:╮(╯▽╰)╭作为全球最大的显示器WA美好时光。

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath> using namespace std; //题目方式摆放
int getmin(double x, double y)
{
int a = (int)x,m = 0;
int b = (int)(2.0*(y-1.0)/sqrt(3.0))+1;
if (m < a*b-b/2)
m = a*b-b/2;
a = (int)x;
if (a+0.5 <= x && m < a*b)
m = a*b;
return m;
} //最大数目摆放
int getmax(double x, double y)
{
int a = (int)x,m = 0;
//n+1,n,n+1方式
while (a > 1 && y >= 1) {
double d = (x-1.0)/(a-1.0);
if (d >= 2) break;
double r = sqrt(1.0-0.25*d*d);
if (r < 0.5) r = 0.5;
int b = (int)((y-1.0)/r)+1;
if (m < a*b-b/2)
m = a*b-b/2;
a --;
}
//n,n,n方式
a = (int)x;
while (a > 0 && y >= 1) {
double d = 2*(x-1.0)/(2*a-1.0);
if (d >= 2) break;
if (d >= 1) {
double r = sqrt(1.0-0.25*d*d);
if (r < 0.5) r = 0.5;
int b = (int)((y-1.0)/r)+1;
if (m < a*b)
m = a*b;
}
a --;
}
return m;
} int main()
{
double x,y;
while (cin >> x >> y) {
int n = (int)x*(int)y,m = 0,p,q; p = getmin(x, y);
if (p > m) m = p;
q = getmin(y, x);
if (q > m) m = q; if (m > n && x >= 1 && y >= 1)
cout << m << " skew" << endl;
else cout << n << " grid" << endl;
}
return 0;
}

版权声明:本文博客原创文章,博客,未经同意,不得转载。

UVa 121 - Pipe Fitters的更多相关文章

  1. UVA 303 Pipe

    点击打开链接 题意: 求光线能达到的最大横坐标 注意光线可以和管道重合 也可以经过转折点 解法: 枚举每种光线是否能通过每个转折点的截面(线段)即可 //大白p263 #include <cma ...

  2. HOJ题目分类

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

  3. echarts地图 绘制部分上海市公交线路数据

    源代码地址 https://github.com/a1115040996/MyHTML/blob/gh-pages/echarts/roadMap.html 预览地址 https://a1115040 ...

  4. Uva 12186 工人的请愿书

    题目链接:https://uva.onlinejudge.org/external/121/12186.pdf 题意: 给出一个树状关系图,公司里只有一个老板编号为0,其他人员从1开始编号.除了老板, ...

  5. UVA 10798 - Be wary of Roses (bfs+hash)

    10798 - Be wary of Roses You've always been proud of your prize rose garden. However, some jealous f ...

  6. UVa 12100 Printer Queue (习题 5-7)

    传送门:https://uva.onlinejudge.org/external/121/12100.pdf 题意:队列中待打印的任务(1 <= n <= 100)带有优先级(1-9), ...

  7. [uva] 10067 - Playing with Wheels

    10067 - Playing with Wheels 题目页:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Ite ...

  8. Fast Matrix Operations(UVA)11992

    UVA 11992 - Fast Matrix Operations 给定一个r*c(r<=20,r*c<=1e6)的矩阵,其元素都是0,现在对其子矩阵进行操作. 1 x1 y1 x2 y ...

  9. angular2系列教程(六)两种pipe:函数式编程与面向对象编程

    今天,我们要讲的是angualr2的pipe这个知识点. 例子

随机推荐

  1. $.getJSON(url,function success(){})回调函数不起作用

    有个问题好久没有解决,就是: $.getJSON(url,function success(){}) 其中的回调函数,总也不执行. 以前也做过,但那都是CTRL+C,CTRL+V,也没有细想. 目标就 ...

  2. 外网訪问内网应用实现之无公网IP、多port、固定port、UDP等应用的实现方法

    有公网IP时,能够通过路由映射来实现外网訪问内网.然,当没有公网IP时,怎样实现外网訪问内网应用? 硬件路由方法因为无公网不可行,能够使用软件port映射的方法.如开放的NAT123全port映射. ...

  3. linux 进程间信号量管理程序之sem_timedwait使用

    在开发过程中,有三个独立执行的程序模块,三个模块都对sqlite数据库进行读写操作.sqlite在linux共享性较差,所以须要增加相互排斥信号量解决三个模块訪问数据库该问题. 另外,在增加信号量后, ...

  4. D3DXMatrixMultiply 函数

    D3DXMatrixMultiply 函数 两个矩阵相乘. 定义:D3DXMATRIX *WINAPI D3DXMatrixMultiply(           D3DXMATRIX *pOut,  ...

  5. paip.最新的c++ qt5.1.1环境搭建跟hello world

    paip.最新的c++ qt5.1.1环境搭建跟hello world 作者Attilax ,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:http://bl ...

  6. Mini-project # 1 - Rock-paper-scissors-___An Introduction to Interactive Programming in Python"RICE"

    Mini-project description - Rock-paper-scissors-lizard-Spock Rock-paper-scissors is a hand game that ...

  7. MongoDB Linux下的安装和启动(转)

    1. 下载MongoDB,此处下载的版本是:mongodb-linux-i686-1.8.1.tgz.tar. http://fastdl.mongodb.org/linux/mongodb-linu ...

  8. Windows下配置Mysql

    这里说的配置Mysql,是在安装时进行的,请先查看:Windows平台下安装Mysql 紧接上文,安装完成后将配置选项打上对勾,按下“Finish”,出现下面的界面,这里有一个很好的功能,mysql配 ...

  9. Tortoisegit 记住用户名和密码

    Tortoisegit 记住用户名和密码方法: [Windows系统] 当你配置好git后,在 C:\Documents and Settings\Administrator\ 目录下有一个  .gi ...

  10. jQuery(二)

    table 全选.反选.清除 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...