啤酒和饮料 蓝桥杯
来源:互联网 发布:mysql count 两个字段 编辑:程序博客网 时间:2024/04/28 18:35
Description
啤酒每罐2.3元,饮料每罐1.9元。小明买了若干啤酒和饮料,一共花了s元。 我们还知道他买的啤酒比饮料的数量少,请你计算他买了几罐啤酒。
Input
输入数据有多组,每组占一行,包含小明买东西花的总钱数s。
Output
每行一组数据,输出小明买了多少罐啤酒。
Sample Input
82.3
Sample Output
#include<iostream>
using
namespace
std;
int
main()
{
double
s;
while
(cin>>s)
{
for
(
int
i = 1; i * 2.3 <= s; i++)
for
(
int
j = i + 1; i * 2.3 + j * 1.9 <= s; j++)
{
if
(i * 2.3 + j * 1.9 >= s - 0.000001 && i * 2.3 + j * 1.9 <= s + 0.000001)
cout<<i<<endl;
} }
return
0;
}
/**************************************************************
Problem: 2505
User: 201358505136
Language: C++
Result: Accepted
Time:4 ms
Memory:1268 kb
****************************************************************/
0 0
- 啤酒和饮料 蓝桥杯
- 啤酒和饮料~~蓝桥杯
- 蓝桥杯 啤酒和饮料
- 啤酒和饮料 蓝桥杯
- 2014蓝桥杯:啤酒和饮料
- 蓝桥杯 啤酒和饮料(精度问题)
- 蓝桥杯Problem C: 啤酒和饮料
- 【蓝桥杯-第五届】 啤酒和饮料
- 啤酒和饮料
- 啤酒和饮料
- 啤酒和饮料
- 啤酒和饮料
- 啤酒和饮料 问题
- 啤酒和饮料
- LQB - 啤酒和饮料
- 啤酒和饮料
- 啤酒和饮料
- 1001-啤酒和饮料
- Android基础 - No Launcher activity found!
- linux 如何改变include路径
- 解决josn长度的错误
- c1 Basic network contents - The Internet,Proxy Servers
- 各种工具汇总
- 啤酒和饮料 蓝桥杯
- Linux下Apache虚拟主机目录权限问题
- warning: incompatible implicit declaration of built-in function sqrt [enabled by default]
- 切面条 蓝桥杯
- 例解 autoconf 和 automake 生成 Makefile 文件
- 武功秘籍 蓝桥杯
- SolrCloud使用教程、原理介绍
- 初识Qt绘图QGraphicsItem
- 奇怪的分式 蓝桥杯