Roll the Dice | 프로그래밍의 벗 PivotOJ
PivotOJ

Roll the Dice

시간 제한: 1000ms메모리 제한: 128MB출처: CCC 2006 JuniorBOJ 6856

문제

Diana is playing a game with two dice. One die has m sides labelled 1, 2, 3, ..., m. The other die has n 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 1

  • 2 + 8 = 10
  • 3 + 7 = 10
  • 4 + 6 = 10
  • 5 + 5 = 10
  • 6 + 4 = 10

입력

The input is given as two integers. First, the user is prompted for and must enter in the number m (1 ≤ m ≤ 1000). Second, the user is prompted for and must enter the number n (1 ≤ n ≤ 1000).

출력

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

There is 1 way to get the sum 10.

예제

예제 1

입력
6
8
출력
There are 5 ways to get the sum 10.

예제 2

입력
12
4
출력
There are 4 ways to get the sum 10.
코드를 제출하려면 로그인하세요.