当前位置:网站首页>Results fill in the blanks for beer and drinks
Results fill in the blanks for beer and drinks
2022-07-28 07:01:00 【White mouse zero】
Beer per pot 2.3 element , Beverage cans 1.9 element . Xiao Ming bought some beer and drinks , A total of flowers. 82.3 element .
We also know that he buys fewer beers than drinks , Please calculate how many cans of beer he bought .
Be careful : The answer is an integer .
answer
11
The problem solving process
A very regular topic , It should be noted that floating point numbers here are :abs( actual value - The value of comparison )<1e-n .
Attach code
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double p_price,y_price;
int x,y;
for(x=0;x<=38;x++)
{
for(y=0;y<=44;y++)
{
if(x<y)
{
p_price=x*2.3;
y_price=y*1.9;
if(abs(p_price+y_price-82.3)<1e-8)
cout<<x<<endl;
}
}
}
return 0;
}
边栏推荐
- 技术分享 | 接口测试常用代理工具
- Applet navigator cannot jump (debug)
- DNS forward resolution experiment
- Network - transport layer (detailed version)
- Hdu-1159-commonsubsequence (LCS longest common subsequence)
- Hdu-1097-a hard puzzle (fast power)
- It is recommended to wear air conduction earphones, which do not need to wear in ear
- HDU-1097-A hard puzzle(快速幂)
- Insertion and deletion of nodes in linked list
- Create, traverse and search nodes as required for single linked list
猜你喜欢

Technology sharing | detailed explanation of actual combat interface test request methods get, post

Shell script - sort, uniq, TR, array sort, cut, Eval command configuration

Applet creation component

SSH service configuration

What kind of air conduction Bluetooth headset with good configuration is recommended

Wechat applet custom compilation mode

iptables防火墙

MySQL installation and use

Iptables firewall

Servlet
随机推荐
Esxi community network card driver updated again
Installation and configuration of unit test framework jest with typescript
防火墙——iptables防火墙(四表五链、防火墙配置方法、匹配规则详解)
Method of designing test cases
Gerapy use
[learning notes] process creation
MOOC翁恺C语言第五周:1.循环控制2.多重循环3.循环应用
组管理和权限管理
Network - data link layer
Repair the faulty sector
Software testing (concept)
技术分享 | 服务端接口自动化测试, Requests 库的这些功能你了解吗?
Hdu-1097-a hard puzzle (fast power)
File operation in C language
HDU-5806-NanoApeLovesSequenceⅡ(尺取法)
[learning notes] VIM editor
DNS域名解析服务
shell脚本——正则表达式
Wechat applet custom compilation mode
[learning notes] coding ability