zoj2818题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818 帮忙看看哪错..看完这个要觉得根本就狗屁不通,麻烦给个用c写的代码参考下.#include #include #include int main(){ int a,b,n,i,j,m,s; float

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 15:20:40

zoj2818题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818 帮忙看看哪错..看完这个要觉得根本就狗屁不通,麻烦给个用c写的代码参考下.#include #include #include int main(){ int a,b,n,i,j,m,s; float
zoj2818题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818 帮忙看看哪错..
看完这个要觉得根本就狗屁不通,麻烦给个用c写的代码参考下.
#include
#include
#include
int main()
{
int a,b,n,i,j,m,s;
float k;
while(scanf("%d%d",&b,&n)!=EOF)
{
if(b==0&&n==0)
break;
m=b-1;
s=1;
for(a=2;ab)
j=i-b;
else
j=b-i;
if(j

zoj2818题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818 帮忙看看哪错..看完这个要觉得根本就狗屁不通,麻烦给个用c写的代码参考下.#include #include #include int main(){ int a,b,n,i,j,m,s; float
AC的代码
#include
#include
using namespace std;
int main()
{
long long b,n,i,a,dif,ans;
while(cin>>b>>n&&(b!=0||n!=0))
{
for(i=1,dif=a=0; ; i++)
{
a=pow(i,n);
if( a > b )
{
dif=a-b;
break;
}
}
if( b-pow(i-1,n)