#abc274a. A - Batting Average

A - Batting Average

Score : 100100 points

问题描述

高桥正在制作一款电脑棒球游戏。
他将编写一个程序,以指定的位数显示击球手的打击率。

存在整数 AABB,满足 1A101 \leq A \leq 100BA0 \leq B \leq A
SS 为通过以下方式获得的字符串:

  • BA\dfrac{B}{A} 四舍五入到三位小数,然后按照整数部分(1位数字)、.(小数点)和小数部分(3位数字)的顺序书写,不足部分用零填充。

例如,若 A=7A=7B=4B=4,则有 BA=47=0.571428\dfrac{B}{A} = \dfrac{4}{7} = 0.571428\dots,将其四舍五入到三位小数是 0.5710.571。因此,SS0.571

给定输入的 AABB,要求你输出 SS

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Takahashi is making a computer baseball game.
He will write a program that shows a batter's batting average with a specified number of digits.

There are integers AA and BB, which satisfy 1A101 \leq A \leq 10 and 0BA0 \leq B \leq A.
Let SS be the string obtained as follows.

  • Round off BA\dfrac{B}{A} to three decimal digits, then write the integer part (11 digit), . (the decimal point), and the decimal part (33 digits) in this order, with trailing zeros.

For example, if A=7A=7 and B=4B=4, then BA=47=0.571428\dfrac{B}{A} = \dfrac{4}{7} = 0.571428\dots rounded off to three decimal digits is 0.5710.571. Thus, SS is 0.571.

You are given AA and BB as the input and asked to print SS.

Constraints

  • 1A101 \leq A \leq 10
  • 0BA0 \leq B \leq A
  • AA and BB are integers.

Input

The input is given from Standard Input in the following format:

AA BB

Output

Print SS in the format specified in the Problem Statement. Note that answers in different formats will be considered wrong.

Sample Input 1

7 4

Sample Output 1

0.571

As explained in the Problem Statement, BA=47=0.571428\dfrac{B}{A} = \dfrac{4}{7} = 0.571428\dots rounded off to three decimal digits is 0.5710.571. Thus, SS is 0.571.

Sample Input 2

7 3

Sample Output 2

0.429

BA=37=0.428571\dfrac{B}{A} = \dfrac{3}{7} = 0.428571\dots rounded off to three decimal digits is 0.4290.429. (Note that it got rounded up.)
Thus, SS is 0.429.

Sample Input 3

2 1

Sample Output 3

0.500

BA=12=0.5\dfrac{B}{A} = \dfrac{1}{2} = 0.5 rounded off to three decimal digits is again 0.50.5.
Thus, SS is 0.500. Note that it must have three decimal places.

Sample Input 4

10 10

Sample Output 4

1.000

Sample Input 5

1 0

Sample Output 5

0.000

update @ 2024/3/10 11:32:00