spoj powpow

you can get the judge from here.

this is very tricky problem.

Screenshot from 2015-06-22 12:56:21

https://gist.github.com/4788a7def0f1ebfc8934

Advertisements

spoj ⇒ classical ⇒ andround ⇒ AND Rounds

you can get the problem statement from here.

as we know a&a = a so if we can observe that after k rounds, k elements from left and k elements from right are operated under boolean and operation with the ith element then it is easy to implement the code for it, an implement tweak is to generate three times of the sequence, and generate answer through that if (2*k + 1) < n else and operation on all n elements.

https://gist.github.com/5481f2f90b4204401f85