- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
#geeksforgeeks Candy Packets Problem in geeksforgeeks in C++ | Candy Packets
Source Code: https://drive.google.com/file/d/199fViOZoUhE9FqVdgAj-qetEk-tCTdNd/view?usp=sharing
Question link: https://practice.geeksforgeeks.org/problems/candy-packetssample-test-case-file-to-be-added/0
Question :
Ishaan has N candies with him. He wants to put them in packets. He can put 1 candy in the first packet, 2 candies in the second packet, 4 candies in the third and so on.
Calculate the minimum number of packets he needs to store all the candies if he fills the packets starting from the first packet.
Input :
First line of input contains a single integer T denoting the number of test cases.The only line of each test case contains an integer N.
Output :
For each test case, print the required answer in a new line.
Example :
Input :
3
2
4
7
Output :
2
3
3
Explanation :
Case 1 :
Put 1 candy in first packet.
Put 1 candy in second packet.
Case 2 :
Put 1 candy in first packet.
Put 2 candies in second packet.
Put 1 candy in third packet.
Case 3 :
Put 1 candy in first packet.
Put 2 candies in second packet.
Put 4 candy in third packet.
Видео #geeksforgeeks Candy Packets Problem in geeksforgeeks in C++ | Candy Packets канала Simple Snip Code
Question link: https://practice.geeksforgeeks.org/problems/candy-packetssample-test-case-file-to-be-added/0
Question :
Ishaan has N candies with him. He wants to put them in packets. He can put 1 candy in the first packet, 2 candies in the second packet, 4 candies in the third and so on.
Calculate the minimum number of packets he needs to store all the candies if he fills the packets starting from the first packet.
Input :
First line of input contains a single integer T denoting the number of test cases.The only line of each test case contains an integer N.
Output :
For each test case, print the required answer in a new line.
Example :
Input :
3
2
4
7
Output :
2
3
3
Explanation :
Case 1 :
Put 1 candy in first packet.
Put 1 candy in second packet.
Case 2 :
Put 1 candy in first packet.
Put 2 candies in second packet.
Put 1 candy in third packet.
Case 3 :
Put 1 candy in first packet.
Put 2 candies in second packet.
Put 4 candy in third packet.
Видео #geeksforgeeks Candy Packets Problem in geeksforgeeks in C++ | Candy Packets канала Simple Snip Code
Комментарии отсутствуют
Информация о видео
6 сентября 2020 г. 13:30:11
00:12:23
Другие видео канала





















