链接:

https://vjudge.net/problem/LightOJ-1275

题意:

A group of N Internet Service Provider companies (ISPs) use a private communication channel that has a maximum capacity of C traffic units per second. Each company transfers T traffic units per second through the channel and gets a profit that is directly proportional to the factor T(C - T*N). The problem is to compute the smallest value of T that maximizes the total profit the N ISPs can get from using the channel. Notice that N, C, T, and the optimal T are integer numbers.

思路:

函数最大值,直接计算,顺便再求下误差。

代码:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map> using namespace std;
typedef long long LL;
const int INF = 1e9; const int MAXN = 1e6+10;
const int MOD = 1e9+7; int main()
{
int t, cnt = 0;
int n, c;
scanf("%d", &t);
while(t--)
{
printf("Case %d: ", ++cnt);
scanf("%d%d", &n, &c);
if (n == 0)
{
puts("0");
continue;
}
int res = c/(2*n);
if ((res+1)*(c-(res+1)*n) > (res*(c-res*n)))
res = res+1; printf("%d\n", res);
} return 0;
}

LightOJ-1275-Internet Service Providers(数学)的更多相关文章

  1. 1275 - Internet Service Providers

    1275 - Internet Service Providers    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory L ...

  2. POJ 3911:Internet Service Providers

    Internet Service Providers Time Limit: 2MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I ...

  3. Laravel 之Service Providers

    Service providers are the central place of all Laravel application bootstrapping. Your own applicati ...

  4. Custom Data Service Providers

    Custom Data Service Providers Introduction Data Services sits above a Data Service Provider, which i ...

  5. 自定义Data Service Providers

    自定义Data Service Providers 作者:AlexJ 翻译:谈少民 原文链接:http://blogs.msdn.com/b/alexj/archive/2010/01/07/data ...

  6. Hyperledger Fabric Membership Service Providers (MSP)——成员服务

    Membership Service Providers (MSP) 本文将介绍有关MSPs的设置和最佳实践的详细方案. Membership Service Providers (MSP)是一个旨在 ...

  7. 使用SAP云平台 + JNDI访问Internet Service

    以Internet Service http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Walldorf&destin ...

  8. Internet 校验和的数学性质

    Internet 校验和(Checksum)仅计算头部的正确性,这一点很重要,这意味着 IP 协议不检查 IPv4 packet 有效载荷部分的数据正确性.为了保证有效载荷部分的正常传输,其他协议必须 ...

  9. lightoj 1148 Mad Counting(数学水题)

    lightoj 1148 Mad Counting 链接:http://lightoj.com/volume_showproblem.php?problem=1148 题意:民意调查,每一名公民都有盟 ...

随机推荐

  1. 06 BootStrap前端开发框架(超级好用)

    1.BootStrap概念: 一个前端开发的框架,Bootstrap,来自 Twitter,是目前很受欢迎的前端框架.Bootstrap 是基于 HTML.CSS.JavaScript 的,它简洁灵活 ...

  2. 18 IO流(十五)——RandomAccessFile随机访问文件及使用它进行大文件切割的方法

    本文部分内容转自:https://blog.csdn.net/nightcurtis/article/details/51384126 1.RandomAccessFile特点 RandomAcces ...

  3. Typora语法使用说明

    目录 文本 标题 超链接 锚点 列表 引用 插入图片 脚注 代码 LaTex公式 插入表情 任务列表 高亮 注脚 文本 代码: *斜体* **粗体** ***斜体加粗体*** ~~删除线~~ < ...

  4. golang ---网卡信息

    package main import ( "fmt" "log" "net" "strings" ) type Net ...

  5. [高清] Excel函数速记手册

    ------ 郑重声明 --------- 资源来自网络,纯粹共享交流, 如果喜欢,请您务必支持正版!! --------------------------------------------- 下 ...

  6. Springboot 之 静态资源路径配置

    1.静态资源路径是指系统可以直接访问的路径,且路径下的所有文件均可被用户通过浏览器直接读取. 2.在Springboot中默认的静态资源路径有:classpath:/META-INF/resource ...

  7. wpf Log4net的配置和使用

    现在项目涉及的是cs客户端,在项目中使用log4net记录本地日志和异常信息,这里项目做完了,想着自己做一个demo,测试记录一下log4Net的配置使用. 第一步.新建一个wpf应用程序,项目右键 ...

  8. emacs手动安装、解决不能使用中文输入法

    emacs的安装 emacs的下载,解压 wget http://mirrors.ustc.edu.cn/gnu/emacs/emacs-25.3.tar.gz tar -zxf emacs-25.3 ...

  9. glfw内存泄露测试

    1. glfwInit()   和  glfwTerminate()  放在主线程  循环次数 1    内存   14M 循环次数100    46M 循环次数1000   49M 2.  glfw ...

  10. js校验规则--去空格、加空格

    为了更加直观,有些号码需要加空格: // 拼接空格,每4位加一个空格 let bankAccount = '6228888888888888888'; let blank_value = bankAc ...