|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||1024 MB||6||5||4||80.000%|
The kids in Iceland are pretty lucky. Not only do they have one Santa Claus, but N of them! They’re called the Yule Lads, and on each of the N nights before Christmas, one of them comes to town, giving those that have been nice a small present, and those that have been naughty a potato.
On a street in a small town in Iceland, there are N houses, numbered in turn from 1 to N. Each house is beautifully decorated with Christmas lights, and initially they are all turned on.
On each of the N nights before Christmas, one of the Yule Lads visits this street. The Yule Lad visiting K nights before Christmas is very fond of the number K, and will only visit the houses whose house number is divisible1 by K. Furthermore, the Yule Lads are troublemakers, and will toggle the state of the Christmas lights on every house that they visit (i.e. turning the lights off if they are on, or turning them on if they are off).
However, some of the Yule Lads have been feeling sick, and did not come to town. On Christmas day all but the first house had their lights turned on. How many Yule Lads came to town?
1An integer p is divisible by the integer q if the division p/q leaves no remainder.
The first line of input contains a positive integer N, the number of Yule Lads and the number of houses in the street.
Output a single integer, the number of Yule Lads that came to town. You can assume that there is only one scenario that leads to all houses having their lights on except for house number 1.
Consider the case N = 6. Then there are six Yule Lads, and six houses in the street. Here is what happens on each of the six nights before Christmas, assuming that no Yule Lad is sick.
However, house number 4 has its lights off on Christmas day, contrary to what actually happened.
On the other hand, if only the Yule Lad that was supposed to come into town four days before Christmas is sick, then all lights, except for at house number 1, will be lit on Christmas day. The correct answer is thus 5: Yule Lads came to town 6, 5, 3, 2 and 1 days before Christmas.