[VIEWED 19558
TIMES]
|
SAVE! for ease of future access.
|
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 06-10-14 10:08
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
q. A total of thirteen pennies is put into three piles so that each pile has a different number of pennies. Obviously, this can be done in several ways. Here’s the challenge – what is the fewest possible number of pennies in the largest pile of any of the possible combinations?
|
|
|
|
serial
Please log in to subscribe to serial's postings.
Posted on 06-10-14 10:22
AM [Snapshot: 12]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
paradox
Please log in to subscribe to paradox's postings.
Posted on 06-10-14 10:39
AM [Snapshot: 31]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
paradox
Please log in to subscribe to paradox's postings.
Posted on 06-10-14 10:40
AM [Snapshot: 32]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
Kiddo
Please log in to subscribe to Kiddo's postings.
Posted on 06-10-14 11:38
AM [Snapshot: 63]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
How is Serial correct? Serial's largest pile is 6 and yours (and mine) is 5. The goal is to have fewest number of pennies in the largest pile. 5<6.
|
|
|
serial
Please log in to subscribe to serial's postings.
Posted on 06-10-14 11:46
AM [Snapshot: 66]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
each pile has a different number of pennies
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 06-10-14 12:28
PM [Snapshot: 86]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
Kiddo
Please log in to subscribe to Kiddo's postings.
Posted on 06-10-14 12:30
PM [Snapshot: 90]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Got it. Ali logical puzzle sodhnu paryo bro, not trick questions.
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 06-10-14 12:30
PM [Snapshot: 91]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Q. There are 1000 persons in a circle, numbered 1 thru 1000. Going around the circle, every second person is removed from the circle, starting with person number 2, 4, and so on. this is done repeatedly until one person is left. Which number person out of 1000 will that be?
|
|
|
OBAMA
Please log in to subscribe to OBAMA's postings.
Posted on 06-10-14 12:37
PM [Snapshot: 109]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
Niral
Please log in to subscribe to Niral's postings.
Posted on 06-10-14 12:40
PM [Snapshot: 110]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
ramronepal
Please log in to subscribe to ramronepal's postings.
Posted on 06-10-14 2:26
PM [Snapshot: 161]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
Gabbar Singh
Please log in to subscribe to Gabbar Singh's postings.
Posted on 06-10-14 2:53
PM [Snapshot: 182]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 06-10-14 3:12
PM [Snapshot: 189]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
Gabbar Singh
Please log in to subscribe to Gabbar Singh's postings.
Posted on 06-10-14 3:19
PM [Snapshot: 203]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Well, i also think its 1 now...First round ma sabai even numbers will get eliminated..so second round ma you start from 3 (alternate) and eliminate all odd numbers and 1 remains till the end...just a guess
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 06-10-14 3:50
PM [Snapshot: 226]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Gabbar Singn Bro: 2 round ma game complete hudaina ni ta... First round: remove all even numbers. remaining numbers: 1,3,5,7,9,11....999, secoun round: remove alternate numbers .starting at 1 again. remaining numbers: 1, 5, 9, 13 , 17.... third round...............
|
|
|
fuckeetow
Please log in to subscribe to fuckeetow's postings.
Posted on 06-10-14 5:14
PM [Snapshot: 294]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
After every round the total number of people is even. Every round starts from number 1. From the first round, when the total number of people is even and the starting number is 1, the people on both sides of 1 go out but 1 remain. Hence, survivor = 1.
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 06-10-14 6:20
PM [Snapshot: 329]
Reply
[Subscribe]
|
Login in to Rate this Post:
1
?
Liked by
|
|
Perfect answer by NAS: +2 Here is my version of code: import java.util.ArrayList; import java.util.List; public class jpt1 { static int toalPeople=1000; static int result=0; static int x; static int count = 1000; public static void main(String[] args) { List result= numberLeft(toalPeople); System.out.println("last remaining person: "+ result); } static public List numberLeft(int x){ ArrayList list = new ArrayList(); for (int i = 1; i <= toalPeople; i++) { list.add(i); } System.out.println("list "+list); while(count>1){ for (int i = 0; i < list.size()-1; i++) { list.remove(i+1); } System.out.println(" Remaining people : "+list.size()); count = list.size(); } System.out.println(); return list; } } Output: Remaining people : 500 Remaining people : 250 Remaining people : 125 Remaining people : 63 Remaining people : 32 Remaining people : 16 Remaining people : 8 Remaining people : 4 Remaining people : 2 Remaining people : 1
last remaining person: [1]
|
|
|
helpjava11
Please log in to subscribe to helpjava11's postings.
Posted on 06-10-14 7:00
PM [Snapshot: 351]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Niral , Obama, Fuckeeto, Gabbar Singh also answered correctly but without solution so (+1) to each. NAS bro, ur code is awesome as well and complete with user input. Thats the way it should be. I was trying to be fast, still have 2 unnecessary variable to be cleaned up.
|
|
|
ramronepal
Please log in to subscribe to ramronepal's postings.
Posted on 06-10-14 10:44
PM [Snapshot: 388]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Helpjava11, that is wrong, either your programming is wrong (i don't have knowledge about programming) or something else is wrong. If you remove every second person in a circle, it will work until there is even no. like ...1000 to 500 to 250 to 125. If you remove, 2, 4, 6.......... 998, 1000, then no. 1 will be saved. But when you come to round 4th, after you remove 124th, 125th will be saved and no. 1 will be removed. Please write the no. in the circle and do it by yourself, and you will know it :)
|
|
|