Link to problem : https://online.codingblocks.com/player/10239/content/4855
Link to my code : https://ide.codingblocks.com/s/43697
Sample inputs are getting passed but on submission compiler shows wrong answer
Link to problem : https://online.codingblocks.com/player/10239/content/4855
Link to my code : https://ide.codingblocks.com/s/43697
Sample inputs are getting passed but on submission compiler shows wrong answer
I solved the question without using power function
Link : https://ide.codingblocks.com/s/43711
But still i am getting incorrect answer
Hey Shubham, actually N is a very large number and when you compute (N/2)^K it becomes a -ve number as (N/2)^K is larger than the range of long long int. So, i have corrected your code you can refer this.
Sir, still one test case is not getting passed.
Sir, there is a issue with the number of zeroes in the value of e , on increasing number of zeroes the case that was failing earlier gets passed and the other one fails.
Hey Shubham, actually there is just a small catch in main(), just put an if check in main()
if(k==1){
cout<<n<<endl;
}
else{
root(n,k) ;
}
Here, I am sharing the updated code, you can refer this, it’s working fine.