problem link here. according to the problem i have coded it and online judge is saying wrong answer on test case 4.Then i checked out that test case it was input:99 970300.it was giving output "YES 2" while code is checked by code force but while i am giving the input in code blocks it is showing "NO" as output which is the correct ans. I can not find why it is not working. judes result link here.
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int c,d;
cin>>c>>d;
double x,y;
x=log(c);
y=log(d);
x=y/x;
int t=powl(c,x);
if(t==d)
{
cout<<"YES"<<endl;
cout<<x-1<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
Aucun commentaire:
Enregistrer un commentaire