The Answer to Everything

What is the answer to the ultimate question of Life, the universe, and everything?

It is ![](upload://2wBe1CqT2RgqJ5bNKiMlN8vMMJD.jpeg)


This is a companion discussion topic for the original entry at https://toph.co/p/the-answer-to-everything

@hjr265

Why WA?

#include <bits/stdc++.h>

using namespace std;

int main() {
	long long int t;
	cin>>t;
	while(t--){
		long long int n,k,m;
		cin>>n>>k>>m;
		cout<<(int)pow(sqrt(n)+sqrt(n+1),2*k)%m<<endl;
	}
	return 0;
}

From just a quick look: I see you are using pow(). Shouldn’t you be using an implementation of modpow()? You might want to read about Modular Exponentiation.

If I use modpow() still its giving WA :frowning: