|
|
вернуться в форумwhy i got WA ?? ( thank you ) Послано PPJ 9 ноя 2002 22:04 i think it's correc solution if its algo is worng pls give me some input thank you here is my program #include <stdio.h> #define min(a,b) ((a<b)?(a):(b)) int ffindlog(long m){ int i; long nn; for(i=0,nn=1;nn<m;i++,nn*=2); return i; } long fgern(long m,int nn){ int i; long sasom; sasom=1; for(i=0;i<nn;i++,sasom*=2); return (sasom-m); } int main(void){ FILE *fi=stdin,*fo=stdout; int first; long n,k,gern,last; fscanf(fi,"%ld %ld\n",&n,&k); first=ffindlog(min(k,n)); gern=fgern(k,first); n=n-gern-k; last=n/k+((n%k==0)?(0):(1)); fprintf(fo,"%ld\n",(first+last)); return fclose(fi)+fclose(fo); } ok i get AC Послано PPJ 9 ноя 2002 22:11 ok i get AC thank you everybody for see my program |
|
|