Загрузка [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

printРабочее место участника

printЗадачи

2746. Spell Combos

Ограничения: время – 250ms/500ms, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

Basic Cast reduces enemy health by 1, while Diffindo take away the smallest prime factor of current enemy health.

Determine the minimum length of a sequence of spells after which the enemy's health will become 0.

The first line contains a single integer N (1N<109) – the enemy's health.

Output the the minimum length of spell combo.

Sample Input 1

5

Sample Output 1

1

Sample Input 2

10

Sample Output 2

3

Use Diffindo (10-2=8), Basic Cast (8-1=7), and Diffindo again (7-7=0).

loading