推出公式  然后特判两端  代码其实挺烂      但是有人竟然可以直接暴过去的 ......

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector> using namespace std; int main()
{
double A,B;
int c;
scanf("%lf%lf%d",&A,&B,&c);
int _maxb,_maxc;
double _maxa = -100000;
for(int p = 0; p <= c; p++)
{
int d = (int)((A+2*p-B)/4);
if(d < 0)
d = 0;
if(d > p)
d = p;
for(int j = d-1; j <= d+1; j++)
{
if(j >= 0 && p-j >= 0)
{
double k = j*A+(p-j)*B - j*j- (p-j)*(p-j);
if(k > _maxa)
{
_maxa = k;
_maxb = j;
_maxc = p-j;
}
}
}
}
printf("%.2lf\n",_maxa);
printf("%d %d\n",_maxb,_maxc);
return 0;
}

ural 1200的更多相关文章

  1. URAL 1200 Horns and Hoofs 枚举

    设horns和hoofs的数量分别为 x 和 y ,题目要求: 满足 x+y <= K,使得A*x + B*y - x*x - y*y 最大. 枚举 i 从0~K,直接解方程得对称轴 x = ( ...

  2. 【BZOJ1814】Ural 1519 Formula 1 (插头dp)

    [BZOJ1814]Ural 1519 Formula 1 (插头dp) 题面 BZOJ Vjudge 题解 戳这里 上面那个链接里面写的非常好啦. 然后说几个点吧. 首先是关于为什么只需要考虑三进制 ...

  3. C语言 · 打印1-200之间的素数

    素数定义:除了1和本身再无其他整数可被其本身整除的数称为素数,也称质数. 举一例子打印出1-200之间所有的素数: #include<stdio.h> #include<math.h ...

  4. POJ 1200 字符串HASH

    题目链接:http://poj.org/problem?id=1200 题意:给定一个字符串,字符串只有NC个不同的字符,问这个字符串所有长度为N的子串有多少个不相同. 思路:字符串HASH,因为只有 ...

  5. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  6. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  7. ural 2073. Log Files

    2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...

  8. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  9. ural 2069. Hard Rock

    2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...

随机推荐

  1. android用异步操作AsyncTask编写文件查看器

    Activity程序 package com.example.fileasynctaskproject; import java.io.File; import java.util.ArrayList ...

  2. crackme_zapline分析

    [破文标题]crackme_zapline 分析 [破文作者]CloAk [作者邮箱]@qq.com [作者主页] [破解工具]OD,... [破解平台]Windows --------------- ...

  3. 使用gulp脚本配合TypeScript开发

    目标:编写TypeScript时,保存即生成js文件.   使用npm安装以下组件 gulp gulp-rename through-gulp gulp-typescript   编写gulpfile ...

  4. java 内部类定义在局部时需要注意的情况

    /*内部类定义在局部时,1,不可以被成员修饰符修饰2,可以直接访问外部类中的成员,因为还持有外部类中的引用.    但是不可以访问它所在的局部中的变量.只能访问被final修饰的局部变量.*/clas ...

  5. STL--string(转载)

    string类的构造函数: string(const char *s); //用c字符串s初始化 string(int n,char c); //用n个字符c初始化 此外,string类还支持默认构造 ...

  6. ajax 内部值 外部调用不了原因

    var id=‘123’; $.ajax({ url:’http://www.xxx.com/ajax', type:'post', dataType: "json", data: ...

  7. 【原】Oracle查询指定表里的触发器

    select * from all_triggers WHERE table_name='表名'

  8. 购买 CDRTools 2 正式版

    联系方式: Email:396390927@qq.com QQ: 396390927    QQ群: 26326434  组件价格: ¥50元/用户,免费更新: 此物为数字商品,并经过测试完全可用,谢 ...

  9. fedora -- java多版本切换

    一般java开发时会下载多个版本的SDK,所以需要多个版本中进行切换 1. 设置JAVA_HOME环境变量需要打开.bashrc文件 2. 安装时使用alternatives将不同版本的java连接到 ...

  10. MySQL创建数据库[保存mojo格式的数据库]已经常用的utf8格式数据库

    一.创建最新编码utf8mb4格式的库: CREATE DATABASE IF NOT EXISTS yourdbname CHARACTER SET utf8mb4 COLLATE utf8mb4_ ...