freeCodeCamp/curriculum/challenges/russian/08-coding-interview-prep/project-euler/problem-31-coin-sums.russia...

1.7 KiB
Raw Blame History

id challengeType title videoUrl localeTitle
5900f38b1000cf542c50fe9e 5 Problem 31: Coin sums Задача 31: Суммы монет

Description

В Англии валюта состоит из фунта, фунта стерлингов и фунта стерлингов, а в общей тираж - восемь монет: 1p, 2p, 5p, 10p, 20p, 50p, £ 1 (100p) и £ 2 (200p). Можно сделать £ 2 следующим образом: 1 × £ 1 + 1 × 50p + 2 × 20p + 1 × 5p + 1 × 2p + 3 × 1p. Сколько разных способов может быть выполнено (n) с использованием любого числа монет?

Instructions

Tests

tests:
  - text: <code>coinSums(50)</code> должен вернуть 451.
    testString: 'assert(coinSums(50) == 451, "<code>coinSums(50)</code> should return 451.");'
  - text: <code>coinSums(100)</code> должен возвращать 4563.
    testString: 'assert(coinSums(100) == 4563, "<code>coinSums(100)</code> should return 4563.");'
  - text: <code>coinSums(150)</code> должен вернуть 21873.
    testString: 'assert(coinSums(150) == 21873, "<code>coinSums(150)</code> should return 21873.");'
  - text: <code>coinSums(200)</code> должен вернуть 73682.
    testString: 'assert(coinSums(200) == 73682, "<code>coinSums(200)</code> should return 73682.");'

Challenge Seed

function coinSums(n) {
  // Good luck!
  return n;
}

coinSums(200);

Solution

// solution required