dnazirzhanov05's blog

By dnazirzhanov05, history, 4 years ago, In English

Please , help to solve this problem.

Flag

The ratio of length to width of the national flag of Kyrgyzstan is 5:3.For a given natural number K (the length or width of the flag), find its area (as a natural number or a mixed fraction with the lowest possible denominator).

Input data format :** natural number K, 2 <= K <= 100. If K <= 50, this is the width, otherwise it is the length.

Output format : a single integer or three natural numbers (the integer part, the numerator and denominator) Examples : 8 ---> 106 2 3

75 ---> 3375

  • Vote: I like it
  • +1
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

If k <= 50, it is $$$5k^2/3$$$
Else it is $$$3k^2/5$$$

In each case just calculate the numerator and see if it is divisible by the denominator.

  • if it is then print the quotient

  • otherwise print (num/denom) (num%denom) (denom)