https://codeforces.com/contest/1183/problem/C

题解:二分

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,p,l,r,u,v;
int ans,cnt,flag,temp,sum;
int a,b;
char str;
struct node{};
bool sloved(int mid){return (ll)mid*a+(ll)(n-mid)*b<k;
}
int main()
{
#ifdef DEBUGfreopen("input.in", "r", stdin);//freopen("output.out", "w", stdout);
#endif//ios::sync_with_stdio(false);//cin.tie(0);//cout.tie(0);scanf("%d",&t);while(t--){scanf("%d%d%d%d",&k,&n,&a,&b);l=0;r=n;ans=-1;while(l<=r){int mid=(l+r)>>1;if(sloved(mid)){ans=mid;l=mid+1;}else{r=mid-1;}}cout<<ans<<endl;}#ifdef DEBUGprintf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif//cout << "Hello world!" << endl;return 0;
}

Computer Game相关推荐

  1. Computer OS系统基本原理

    Computer OS系统基本原理 第一章 绪论(考概念) 什么是OS? o 操作系统是一组控制和管理计算机软硬件资源.合理地对各类作业进行调度以及方便用户使用的程序集合. o 操作系统是位于硬件层( ...

  2. UVa12096.The SetStack Computer

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  3. Computer Vision Tasks

    Computer Vision Tasks: 图像分类.目标检测.语义分割.实例分割: 只有目标检测和实例分割是实现了实例级别的识别的,就是把每一个单独的物体拎出来识别的:目标检测是画框框,而实例分割 ...

  4. OpenStack环境搭建(三:Computer与Controller节点的安装及配置)

    实验要求: 完成Virtual box平台安装,会应用相关操作: 在virtual box虚拟平台上部署Fuel Master节点: 在virtual box虚拟平台上部署计算节点Computer: ...

  5. 计算机科学速成课】[40集全/精校] - Crash Course Computer Science

    计算机科学速成课][40集全/精校] - Crash Course Computer Science Transistor have two electrodes separated by a mat ...

  6. 与计算机硬件相关的英语作文,计算机和计算硬件,computer and computing hardware,音标,读音,翻译,英文例句,英语词典...

    补充资料:计算机硬件 计算机系统中由电子.机械和光电元件等组成的各种计算机部件和计算机设备.这些部件和设备依据计算机系统结构的要求构成的有机整体,称为计算机硬件系统.计算机系统由两个部分组成,一部分是 ...

  7. Computer Systems A Programmer’s Perspective ----阅读翻译日志

    2019独角兽企业重金招聘Python工程师标准>>> 借助google 翻译读一下这本书吧,做个记录 Computer Systems A Programmer's Perspec ...

  8. ACM Computer Factory

    ACM Computer Factory 题目链接:http://poj.org/problem?id=3436 网络流Dinic 将一个机器拆分成两个点,这两个点之间的容量为机器的加工量:建立一个超 ...

  9. HDU4716 A Computer Graphics Problem

    问题链接:HDU4716 A Computer Graphics Problem.入门练习题,用C语言编写. 题意简述:根据输入的数(代表剩余电量,值范围是0到100),打印一个反映剩余电量的字符图案 ...

  10. Rethinking the inception architecture for computer vision的 paper 相关知识

    这一篇论文很不错,也很有价值;它重新思考了googLeNet的网络结构--Inception architecture,在此基础上提出了新的改进方法; 文章的一个主导目的就是:充分有效地利用compu ...

最新文章

  1. Spring-profile设置
  2. html安装网卡驱动,如何手动安装无线网卡驱动,网卡驱动安装教程
  3. 自适应宽度元素单行文本省略用法探究
  4. nacos集群的ap cp切换_阿里Nacos-配置-多环境
  5. RPC(一)[概述]
  6. 计算机应用基础重点分析,计算机应用基础整体设计重点分析.doc
  7. 商务搜索引擎_网络营销外包——网络营销外包公司如何做好电子商务网站优化?...
  8. 爬了知乎 200 万数据,图说程序员都喜欢去哪儿工作
  9. 【语音合成】基于matlab GUI语音合成【含Matlab源码 293期】
  10. arp***的判断与解决方案总结
  11. Internet Download Manager永久版功能强大的网络下载器
  12. excel之快速输入带方块的对号和错号
  13. MySQl学习(从入门到精通 1.1)
  14. rails kaminari bootstrap-kaminari-views certified
  15. 超市进销存管理系统(SSM,MYSQL,VUE,JSP)
  16. oppo android多大内存,OPPO R15使用感受,大内存真的很有必要
  17. php完美导出word,php导出生成word的方法
  18. 链表——24. 两两交换链表中的节点
  19. 用简单算法去除图像抖动
  20. 1943中途岛海战2020年8月22日海龟画图版(原雷电模拟升级版)

热门文章

  1. 【mathematical statistics】2 point estimate
  2. 矩阵论思维导图_矩阵求导与矩阵微分
  3. 函数调用关系图如何画_乌鲁木齐126中一校三址关系图出炉!佳源和绿谷应该如何选择?...
  4. 瑞银监控机器人组装法_瑞银公布Model 3后续拆解报告:装配问题严重 噪音勉强能接受...
  5. oracle hint禁用索引,【轉】Oracle索引HINT的使用
  6. linux接收手机信号,接收关联设备的信号强度在Linux接入点
  7. pythonapi是什么意思_python api是什么
  8. python读取raw数据文件_Python 读写文件中数据
  9. android.mk 优化编译,android下ndk编译c优化
  10. 三十七、深入Vue.js组件Component(下篇)