跳到正文

题解

题解:P1421 小玉买文具

2huk约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
获赞
1
题目
P1421

版本

  1. v1当前

首先 11 元 99 角相当于 1.91.9 元,aa 元 bb 角相当于 a+0.1ba+0.1b 元。那么最多买的支数即 ⌊a+0.1b1.9⌋\left \lfloor \dfrac{a+0.1b}{1.9} \right \rfloor。

C++
#include <iostream>

using namespace std;

const int N = 1e6 + 10;

int main()
{
	int a, b;
	cin >> a >> b;
	cout << (a + b * 0.1) / 1.9;
	return 0;
}
原文