In this exercise, we say that a natural number is round in base , when the sum of of its digits in base equals its number of digits in this base.
For example, the number 34 is not round in base (), but it is round in base , as As another example, is not round in base as but it is round in base (it has ones, that add up to ). Another example: is not round in base , neither in base , …, however it is round in base , because
A sequence of pairs of natural numbers , where is a natural number and , is called bi-round if it does contain at least two pairs with the property that is round in base .
Write a program that, given a sequence of pairs of natural numbers, determines whether it is bi-round or not.
Your program must include, use and implement the function
bool round (int n, int b);
that indicates if a natural number is round on base or not.
The input is a non-empty sequence of pairs of natural numbers with .
The program has to write if the input sequence is bi-round or not.
Please follow the format described in the examples. Your code should follow the style rules and include the appropriate comments.
Input
34 10 34 3 511 16 511 2 370273 2 370273 608
Output
Yes
Input
34 10
Output
No
Input
34 3
Output
No
Input
34 10 511 6 300 10 320 10 34 3
Output
Yes