Page 1 of 1
11173 - Grey Codes
Posted: Sun Apr 15, 2007 10:32 pm
by Oyhama Hora
Hi,
Who know make this problem.
i dont know the logic or the sequence for this problem.
Oyhama
Re: 11173 - Grey Codes
Posted: Thu Jun 12, 2008 3:00 pm
by Piklu_sust
You can solve this problem using some bitwise operation.
For more details:
Read the following book:
Art of Computer programming by Donald Knuth (Volume-4)
Re: 11173 - Grey Codes
Posted: Sat Jul 19, 2014 3:14 am
by Tanmoy1228
please help.
again and again WA.
but can not got the cause.
Re: 11173 - Grey Codes
Posted: Tue Jul 22, 2014 11:50 am
by lighted
As i understand you form binary number in bin but in decimal base.
For n = 30 and some values of k value of bin can be about 10^30.
Max value of unsigned long long is 18446744073709551615.
Change bin to string variant.
Or do it using bitwise operations - &, | <<, >>. It will become very easy when you learn it.
Re: 11173 - Grey Codes
Posted: Tue Jul 22, 2014 6:39 pm
by lighted
Here some input for which your program gives wrong output
Code: Select all
8
15 2246
11 1516
11 1427
14 13986
14 8558
14 10876
14 6252
12 2537
Ac output
Code: Select all
3237
1818
1882
11763
12761
16194
5210
3357
Re: 11173 - Grey Codes
Posted: Wed Feb 11, 2015 6:39 pm
by Tanmoy1228
lighted wrote:As i understand you form binary number in bin but in decimal base.
For n = 30 and some values of k value of bin can be about 10^30.
Max value of unsigned long long is 18446744073709551615.
Change bin to string variant.
Or do it using bitwise operations - &, | <<, >>. It will become very easy when you learn it.
Thank you lighted....