题目大意:

Adilbek有一个特殊项目,他需要运行这个项目得到结果。

但是这个项目直接运行需要消耗d天时间。

他也可以选择优化程序以减少程序运行消耗时间。

假设他用了x天优化程序,那么最后运行程序只需要消耗天的时间(括号指向上取整)。

那么总共需要消耗的天数是

问,他能不能在n天内得到结果?

解题思路:

问能不能在n天内得到结果,只需要求出最少需要的天数与n对比即可。

可得到

那么总天数为

当且仅当

时成立。

所以

又因为x必为整数

所以x取上式向下取整后代入公式,再取向下取整+1代入公式,得出的两个结果取小作为答案。

#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio();
cin.tie();cout.tie();
int T,n,d,x,i,j,k;
cin>>T;
while(T--){
cin>>n>>d;
x=sqrt(d-0.75)-0.5;
if(x+(d+x)/(x+)<=n||x++(d+x+)/(x+)<=n)
cout<<"YES\n";
else
cout<<"NO\n";
} return ;
}

Codeforces 1288A - Deadline的更多相关文章

  1. Educational Codeforces Round 80 (Rated for Div. 2)

    A. Deadline 题目链接:https://codeforces.com/contest/1288/problem/A 题意: 给你一个 N 和 D,问是否存在一个 X , 使得 $x+\lce ...

  2. Educational Codeforces Round 80 A-E简要题解

    contest链接:https://codeforces.com/contest/1288 A. Deadline 题意:略 思路:根据题意 x + [d/(x+1)] 需要找到一个x使得上式小于等于 ...

  3. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  4. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  5. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  6. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  7. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  8. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  9. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

随机推荐

  1. 通过整合遥感数据和社交媒体数据来进行城市土地利用的分类( Classifying urban land use by integrating remote sensing and social media data)DOI: 10.1080/13658816.2017.1324976 20.0204

    Classifying urban land use by integrating remote sensing and social media data   Xiaoping Liu, Jialv ...

  2. java web实现在线编辑word,并将word导出(二)

    前一篇文章介绍了后台将前台html转为word文档的一种方式,但却有一个问题是没法讲图片放置在生成的word报告中.我在网上找了很多方法,甚至将图片转换成base64编码的方式也不成功.效果如下: 由 ...

  3. 体验京东云 Serverless+AI 人脸属性识别

    云原生计算基金会CNCF(Cloud Native Computing Foundation, CNCF)Serverless Whitepaper v1.0对无服务器计算作了如下定义: Server ...

  4. git登录账号密码错误remote: Incorrect username or password (access token)

    git提交时弹框让输入用户和密码,不小心输入错误了 再次提交 一直就提示  remote: Incorrect username or password 错误了,也不弹框要重新输入 解决方法 win1 ...

  5. k8s pod.yml解释

    apiVersion: v1kind: Podmetadata:  name: yueying  namespace: kube-public  labels:    name: testpodssp ...

  6. 流程引擎表单引擎的常见问题技术交流-关于广州xx公司对驰骋BPM提出

    第1章: 先使用.net 再使用java,数据迁移问题?会存在哪些问题. RE: .net 版本的ccflow与java版本的jflow系列版本都是一个数据库结构,一个操作手册,流程模版,表单模版通用 ...

  7. 通过geopandas.sjoin()函数按多边形范围分割点

    最近有一批点和多变型的数据,需要将点按照多边形的区域进行分割. 经过若干尝试,终于通过geopandas的sjoin函数得以实现. 这里首先感谢博主“张da统帅”的分享,使得本人获得该实现方法的灵感, ...

  8. Codeforces Round #568 (Div. 2)网卡&垫底记

    这场和div3差不多嘛(后来发现就是div3),就是网太卡10min交一发就不错了,简直自闭. A 签到. B 记录每一段的字母数,满足条件即:段数相同+字母相同+字母数下>=上. #inclu ...

  9. 5. react 基础 - 组件拆分 和 组件传值

    1.将 todoList 进行拆分 创建 编写TodoList.js import React, {Component, Fragment} from 'react';import TodoItem ...

  10. 多分类度量gini index

    第一份工作时, 基于 gini index 写了一份决策树代码叫ctree, 用于广告推荐. 今天想起来, 好像应该有开源的其他方法了. 参考 https://www.cnblogs.com/mlhy ...