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

分析:计算几何。数论。首先计算矩形显示屏,然后计算互显示器(每一行与相邻行相同差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. HDU1284钱币兑换问题( 母函数打表)

    题意:在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法.请你编程序计算出共有多少种兑法. 原题http://acm.hdu.edu.cn/showproblem.php?pid=128 ...

  2. Android JNI入门第五篇——基本数据类型使用

    前面讲到了java和native数据类型,这里就开始做一下使用: 第一步:新建工程 第二部:书写 java方法: public class NativeMethod { static { System ...

  3. DevExpress ASP.NET 使用经验谈(7)-ASPxTreeList控件使用

    这一节,将介绍ASPxTreeList控件的使用,首先,我们增加一个标准地址库表AddressGB, 建表语句如下: CREATE TABLE [dbo].[AddressGB]( [Code] [v ...

  4. C#语言基础之转义字符、变量、常量、类型转换

    1.转义字符: Tab键:/t    反斜杠://   单引号:/’   双引号:/”   回车:/r   换行:/n 警告:/a      退格:/b    换页:/f      空:/0 2.变量 ...

  5. php怎样求一个数组中最长的

    <?php $arr = array( 0 => 'd', 1 => '68b3', 2 => 'a86', 3 => 'c9aa97b23b71d5c', 4 => ...

  6. Centos6.4安装JDK

    链接地址:http://www.iteye.com/topic/1130311 1.先看看OpenJDK的安装包 $ rpm -qa |grep javatzdata-java-2013b-1.el6 ...

  7. FtpManager类

    public class FtpManager { /// <summary> /// 主机名 /// </summary> string ftpServerIP; /// & ...

  8. JS拖动浮动DIV

    <!DOCTYPE html> <html> <head> <meta charset="utf8"> <title>j ...

  9. java-输出格式

    https://docs.oracle.com/javase/tutorial/java/data/numberformat.html Formatting Numeric Print Output ...

  10. PHP中magic_quotes_gpc和 magic_quotes_runtime区别及其反斜线转义问题

    php中关于反斜线转义: php中数据的魔法引用函数 magic_quotes_gpc  或 magic_quotes_runtime      设置为on时,当数据遇到 单引号' 和 双引号&quo ...