Problem3904--CCC '06 J2 - Roll the Dice

3904: CCC '06 J2 - Roll the Dice

Time Limit: 2 Sec  Memory Limit: 64 MB
Submit: 144  Solved: 18
[Submit] [Status] [Web Board] [Creator:]

Description

English:

Diana is playing a game with two dice. One die has mm sides labelled 1,2,3,…,m.

The other die has nn sides labelled 1,2,3,…,n.

Write a program to determine how many ways can she roll the dice to get the sum 10.

For example, when the first die has 6 sides and the second die has 8 sides, there are 5 ways to get the sum 10:

  • 2 + 8 = 10
  • 3 + 7 = 10
  • 4 + 6 = 10
  • 5 + 5 = 10
  • 6 + 4 = 10
Chinese:
戴安娜(Diana)正在玩两个骰子的游戏。 一个骰子的m面标记为1,2,3,…,m。

另一个骰子的n面标记为1,2,3,…,n。

编写一个程序来确定她可以掷骰子以多少种方式获得总数10。

例如,当第一个骰子有6个边,而第二个骰子有8个边时,有5种方法获得总和10:
  • 2 + 8 = 10
  • 3 + 7 = 10
  • 4 + 6 = 10
  • 5 + 5 = 10
  • 6 + 4 = 10

Input

The input is given as two integers. First, the user will enter in the number m (1≤m≤1000).

Second, the user will enter the number n (1≤n≤1000).



输入为两个整数。 首先,用户将输入数字m(1≤m≤1000)。

其次,用户将输入数字n(1≤n≤1000)。

Output

The program prints out the number of ways 10 may be rolled on these two dice. Note that in the output, the word "way" should be used if there is only one way to achieve the sum of 10; otherwise, the word "ways" should be used in the output. That is, if there is only one way to get the sum 10, the output should be:
There is 1 way to get the sum 10.

程序打印出可以在这两个骰子上滚动出10的方式的数量。 请注意,在输出中,如果只有一种方法可以得出10的总和,则应使用单词“ way”。 否则,应在输出中使用单词“ ways”。 也就是说,如果只有一种方法可以得出总和10,则输出应为:
There is 1 way to get the sum 10.

Sample Input Copy

6
8

Sample Output Copy

There are 5 ways to get the sum 10.

Source/Category

循环