You are not logged in. Please login at www.codechef.com to post your questions!

×

NUKES REACTOR Problem(EASY)

Sir, why are we taking mod of Particle Count with Max Count+1 as chamber value and then dividing it by Max Count+1... ?

Which algorithm is this ?

asked 04 Oct '12, 16:02

parasmth's gravatar image

1★parasmth
31226
accept rate: 0%


If there are A particles, starting from 1 every time you reach Max Count + 1 particles, 1 particle is moved to the consecutive chamber and whole Max Count + 1 particles are destroyed. So, Particles left in the chamber is A % (Max Count + 1) And particles transferred to the next chamber is A / (Max Count + 1) since this will happen again and again starting from 1 to Max Count + 1. See this video it might help you Click

link

answered 08 Oct '12, 18:06

prakhs123's gravatar image

4★prakhs123
33641019
accept rate: 3%

The solution is basically writing A in the base of n+1. This is because at every n+1 particle the carry is taken over to the the next chamber. Think of this in terms of binary and then you'll be able to apply this for every base n+1. That being said, I'm not able to pass the 3rd test case even though I am 100% sure of my solution (all of them are clearing in 0.00s). Is there anything I should look out for in particular ?

link

answered 08 Sep '17, 20:53

shivan111's gravatar image

2★shivan111
101
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×14

question asked: 04 Oct '12, 16:02

question was seen: 4,054 times

last updated: 08 Sep '17, 20:53