Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
哪里有问题啊?#include<stdio.h> int s(int n,int x) { int l,k; k=n; for(l=1;l<x;l++) n*=k; return n; } int main() { int a,b,n,i=1,p,q; scanf("%d%d",&a,&n); while(a!=0&&n!=0) { while(s(i,n)<a) { i++;} p=s(i,n); q=s(i-1,n); if(p-a<a-q) printf("%d\n",i); else printf("%d\n",i-1); scanf("%d%d",&a,&n); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator