102740: [AtCoder]ABC274 A - Batting Average

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $100$ points

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 $A$ and $B$, which satisfy $1 \leq A \leq 10$ and $0 \leq B \leq A$.
Let $S$ be the string obtained as follows.

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

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

You are given $A$ and $B$ as the input and asked to print $S$.

Constraints

  • $1 \leq A \leq 10$
  • $0 \leq B \leq A$
  • $A$ and $B$ are integers.

Input

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

$A$ $B$

Output

Print $S$ 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, $\dfrac{B}{A} = \dfrac{4}{7} = 0.571428\dots$ rounded off to three decimal digits is $0.571$. Thus, $S$ is 0.571.


Sample Input 2

7 3

Sample Output 2

0.429

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


Sample Input 3

2 1

Sample Output 3

0.500

$\dfrac{B}{A} = \dfrac{1}{2} = 0.5$ rounded off to three decimal digits is again $0.5$.
Thus, $S$ 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

Input

题意翻译

给你两个数 $a$,$b$。 求 $\frac{b}{a}$ 近似到千分位后的结果(四舍五入)。

Output

分数:100分 部分

问题描述

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

存在整数 $A$ 和 $B$,满足 $1 \leq A \leq 10$ 和 $0 \leq B \leq A$。
将以下方式获得的字符串记为 $S$。

  • 将 $\dfrac{B}{A}$ 四舍五入到三位小数,然后按顺序写出整数部分(1位)、.(小数点)和小数部分(3位),后跟0。

例如,如果 $A=7$ 和 $B=4$,则 $\dfrac{B}{A} = \dfrac{4}{7} = 0.571428\dots$ 四舍五入到三位小数是 $0.571$。因此,$S$ 为 0.571

您将通过输入获得 $A$ 和 $B$,并被要求打印 $S$。

部分

约束条件

  • $1 \leq A \leq 10$
  • $0 \leq B \leq A$
  • $A$ 和 $B$ 是整数。

部分

输入

输入以标准输入的以下格式给出:

$A$ $B$
部分

输出

以问题描述中指定的格式打印 $S$。 请注意,不同格式的答案将被视为错误。


部分

样例输入 1

7 4
部分

样例输出 1

0.571

如问题描述中所述,$\dfrac{B}{A} = \dfrac{4}{7} = 0.571428\dots$ 四舍五入到三位小数是 $0.571$。因此,$S$ 为 0.571


部分

样例输入 2

7 3
部分

样例输出 2

0.429

$\dfrac{B}{A} = \dfrac{3}{7} = 0.428571\dots$ 四舍五入到三位小数是 $0.429$。(请注意,它被四舍五入了。)
因此,$S$ 为 0.429


部分

样例输入 3

2 1
部分

样例输出 3

0.500

$\dfrac{B}{A} = \dfrac{1}{2} = 0.5$ 四舍五入到三位小数还是 $0.5$。
因此,$S$ 为 0.500。请注意,必须有三位小数。


部分

样例输入 4

10 10
部分

样例输出 4

1.000

部分

样例输入 5

1 0
部分

样例输出 5

0.000

加入题单

算法标签: