版本比较
UVA1374 快速幂计算 Power Calculus
正文
增加 2 行删除 2 行
35 行未改动363738394040414243443 行未改动484950515252535455562 行未改动35 行未改动 { ok=true; return ; } if(step>tot||ok||now<=0||now<<(tot-step+1)<n) return ;//最后一个判断是可行性剪枝 if(step>tot||ok||now<=0||now<<(tot-step+1)<n) return ;//最后一个判断是可行性剪枝 a[step-1]=now; for(int i=0;i<step;i++) { IDA_star(now+a[i],step+1,tot);3 行未改动int main(){ while(scanf("%d",&n),n) { int ans=0;ok=n==1;//特判 n=1 的情况 int ans=0;ok=n==1;//特判 n=1 的情况 while(!ok) IDA_star(1,1,++ans); printf("%d\n",ans); } return 0;2 行未改动