TIGA - Nuts Frenzy

Ivan, Filbert, and Tracy really like nuts. They can eat nuts without stopping all day long if they want to. Today they decided to buy some nuts so each one of them get exactly K nuts (1<=K<=1,000,000,000) and they want to eat it all. To make it interesting, they are only allowed to eat a certain number of nuts every second.

  • Ivan can eat at max I nuts per second. (1<=I<=1,000,000)
  • Filbert can eat at max K/F nuts per second. (1<=F<=100)
  • Tracy can eat at max the sum of all the factors of K excluding 1 and K nuts per second.

They are not allowed to eat only a fraction of a nut every second, and they must eat a minimum of 1 nut every second regardless of the previous rule. They can stop eating after they run out of nuts. Your task is to determine the time needed (in seconds) for each of them to finish their nuts!


The first line of input is T, the number of test case. (T<20)
The next T lines each consists of three numbers K, I, and separated by a space.


For each test case, output the minimum time needed for Ivan, Filbert, and Tracy to finish their nuts.



10 2 5
100 10 4
121 100 1


5 5 2
10 4 1
2 1 11

hide comments
(Tjandra Satria Gunawan)(曾毅昆): 2013-01-19 14:48:07

@Zukow: If you move this problem to tutorial, DIVSUM problem should be moved to tutorial too, don't you think?

:D: 2012-10-28 13:33:16

Again, borderline brute force gets an easy AC. Moving to tutorial.

david_8k: 2012-10-26 03:33:28

Is it the answer for the case "10 3 3" "4 4 2" because:

The first one eats 3+3+3+1 nuts
the second one eats the same quantity of nuts because 10/3 = 3 and then he eats 3+3+3+1, the last one eats 2 because of the factors.

Is it correct? Or am i misunderstanding the problem?

Andy: Read the problem statement

Last edit: 2012-10-28 05:49:03
Hashfi Alfian Ciyuda: 2012-10-23 15:02:13

what is the output if input 5 0 0??

Andy: read the problem statement.

Last edit: 2012-10-23 14:59:46
Ehor Nechiporenko: 2012-10-23 15:02:13

@Tjandra thanks for the help a lot!!!!

(Tjandra Satria Gunawan)(曾毅昆): 2012-10-23 15:02:13

@Ehor Nechiporenko: Yes, actually you miss something. Read the problem statement carefully, it's clearly described that "They are not allowed to eat only a fraction of a nut every second, and they must eat a minimum of 1 nut every second regardless of the previous rule."

Ehor Nechiporenko: 2012-10-23 15:02:13

Sorry but what the answer should be if k is prime, as example 5? In this case Tracy can eat at maximum 0 coconats per second, so he will never finish eating nuts!
What should be in output or did I miss something?

Last edit: 2012-10-22 11:49:23
Vikas Kushwaha: 2012-10-23 15:02:13

is there any special test case..
getting WA.

(Tjandra Satria Gunawan)(曾毅昆): 2012-10-23 15:02:13

@Ehor Nechiporenko: Yes, sometimes k is prime number. and Yes, there's a test with f>k.

Ehor Nechiporenko: 2012-10-23 15:02:13

Could k be prime?? And is there a test, when f > k?

Last edit: 2012-10-22 08:38:12

Added by:Andy
Time limit:0.395s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:own problem