Блог пользователя Summer_Wind

Автор Summer_Wind, история, 4 месяца назад, По-английски

Problem : Given a number k, find a k-digit string where the product of its digits is greater than or equal to the sum of its digits. If there are multiple such strings, return the one with the minimum product. If there are still ties, return the lexicographically smallest string.

Testcases:

Input : 1 Output : 1

Input : 2 Output : 22

Input : 3 Output : 123

Input : 4 Output : 1124

Input : 5 Output : 11222

Input : 6 Output : 111126

Constraints:

1 <= K <= 100000

How to solve this? Please help!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор Summer_Wind, история, 4 месяца назад, По-английски

In Last Div 3, I submitted code E twice, and the first accepted solution was considered. I only added an extra modulus operation in the second submission after 2 minutes.

Today, I submitted twice for Div 2-C. I wanted to remove the sort function since it was an unnecessary burden, but I found that unlike in Div 3, the first solution in Div 2 was not considered, got skipped and my rank worsened.

Can you help explain this behavior and the conditions affecting it?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится