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

Автор tinneminy, 10 лет назад, По-английски

Hello Everyone,

I am writing this for the first time. Issue is i solved Problem 158B Taxi. But in one test case # 37 i got stuck. Question says that we need to print minimum number of taxi required, but in test case the input are as: Input : 3 3 3 2 Output: 3 How come output be 3. Even if i manually do this in real life even then we need 2 taxi. Because maximum 4 person can sit. Therefore total becomes 8. 8/4 we get 2. So we need 2 taxi. I need ur assistance to understand the this.

Thanks in advance

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

»
10 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Actually last line of the problem statement says "if all members of each group should ride in the same taxi (but one taxi can take more than one group)".So in above test case 3 members will take 1 taxi,other 3 will take another and the group of 2 will have to take another since group members can't be in a different taxi.

»
10 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Pay attention to the condition "if all members of each group should ride in the same taxi". You cannot divide members of one group.