why is following code not passing all the test cases
#include
using namespace std;
typedef long long ll;
int main() {
ll a,b,c;
cin>>a>>b>>c;
ll Final=1;
for(ll i=0;i<b;i++){
Final *=a;
}
cout<<(Final+c)%c;
return 0;
}
why is following code not passing all the test cases
#include
using namespace std;
typedef long long ll;
int main() {
ll a,b,c;
cin>>a>>b>>c;
ll Final=1;
for(ll i=0;i<b;i++){
Final *=a;
}
cout<<(Final+c)%c;
return 0;
}
@saurabh66 there comes a specific technique to perform modular exponentiation, it should be in your course or you can learn it from any other sources too.its very simple and effective technique use this for this code.
can you send the code
alright , thank you!