NA
但是其他都AC了
有法反推測資 #5 #6嗎?
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
string str;
int n=0;
while ( cin>>n>>str)
{
float num10=0;
float numchk=0;
int len=str.length();
vector <int> vecData;
for (int i=0;i<len;i++){
vecData.push_back(str[i]-'0');
}
for (int i=1;i<=len;i++){
num10+=vecData[i-1]*pow(n,len-i);
numchk+=pow(vecData[i-1],len);
}
if (num10==numchk){cout<<"YES"<<endl;
}
else
{cout<<"NO"<<endl;
}
vector<int>().swap(vecData);
}
return 0;
}
NA
但是其他都AC了
有法反推測資 #5 #6嗎?
#include
#include <bits/stdc++.h>
using namespace std;
int main()
{
string str;
int n=0;
while ( cin>>n>>str)
{
float num10=0;
float numchk=0;
int len=str.length();
vector vecData;
for (int i=0;i<len;i++){
vecData.push_back(str[i]-'0');
}
for (int i=1;i<=len;i++){
num10+=vecData[i-1]*pow(n,len-i);
numchk+=pow(vecData[i-1],len);
}
if (num10==numchk){cout<<"YES"<<endl;
}
else
{cout<<"NO"<<endl;
}
vector().swap(vecData);
}
return 0;
}
我也錯測資#5