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<iostream> #include <math.h> using namespace std; int Add(int a[][100],int i,int k,int n,int N) { int yushu; if(k>25&&n==0) return 0; else { a[i][k]=a[i][k]*N+n; yushu=a[i][k]/10; a[i][k]%=10; Add(a,i,k+1,yushu,N); } return 0; } int main() { int N,D,i,j,n=1,weishu=0; int sum[100][100]={0}; for(i=0;i<25;i++) { cin>>N>>D; if(N==0&&D==0) break; if(D==0) { sum[i][1]=1; continue; } else sum[i][1]=1; for(j=1;j<=D;j++) { Add(sum,i,1,0,N); } } for(int k=0;k<i;k++) { weishu=0; for(j=27;j>0;j--) { if(sum[k][j]!=0) weishu=1; if(j==1&&sum[k][j]==0&&weishu==0) cout<<weishu+1; if(weishu==0) continue; else cout<<sum[k][j]; } cout<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator