摘要:
enum{Valid,Invalid};int g_valid;double Power(double base,int exponent){ g_valid=Invalid; if(abs(base)=0) sign=1; else { sign=-1; n=-n; } while(n>0) { if(n%2==0) { b=b*b; n=n>>1; } else { ret=ret*b; n=n-1; } } g_valid=Valid; if(sign>0) { return ret; } else { return 1/ret; }} 阅读全文
摘要:
bool g_Increase=false;char *Increase(char *s){ g_Increase=false; if(s==NULL) return NULL; int len=strlen(s); if(len==1) return s; int i=len-2; while(i>=0&&s[i]>=s[i+1]) i--; if(ikey;j++); if(j==len) { swap(s[i],s[j-1]); j=len-1; } else { j-=1; swap(s[i],s[j]); } i++; while(i<j) { sw 阅读全文