int main() { int i; scanf("%d%d",&n,&m); scanf("%s",dr+1); jc[0]=inv[0]=1; for(i=1;i<=n;i++) { jc[i]=jc[i-1]; cheng(jc[i],i); inv[i]=power(jc[i],Mod-2); } int ans=0; int val=zuhe(n-1,m); int zeng=9; for(i=n;i>=1;i--) { int now=dr[i]-'0'; cheng(now,val); jia(ans,now); now=zuhe(i-2,m); cheng(now,zeng); jia(val,now); cheng(zeng,10); } printf("%d\n",ans); return 0; }
int main() { void cheng(int *,int *,int),gjcheng(int *,int *,int *),chu(int *,int),jia(int *,int *); int i,j,k,n; scanf("%d",&n); for (i=1;i<=n;i++) { a[i][0][0]=1; a[i][0][1]=1; for (j=1;j<=i;j++) cheng(a[i][j],a[i][j-1],i-j+1); } f[0][0]=1; f[0][1]=1; for (i=1;i<=n;i++) { memcpy(f[i],f[i-1],sizeof(f[i-1])); for (j=1;j<=i-1;j++) { cheng(b,a[i-1][j],j+1); gjcheng(b,b,f[i-j-1]); chu(b,2); jia(f[i],b); if (j>1 && (j+1)%3!=0) { gjcheng(b,a[i-1][j],f[i-j-1]); chu(b,2); jia(f[i],b); } } } printf("%d",f[n][f[n][0]]); for (i=f[n][0]-1;i>=1;i--) { j=f[n][i]; printf("%d",j/100); j%=100; printf("%d",j/10); j%=10; printf("%d",j); } printf("\n"); system("pause"); return(0); }
int main() { int choose; list *Dxs1,*Dxs2,*re1,*re2; Dxs1 = csh(); Dxs2 = csh(); re1 = csh(); while(true) { clear(Dxs1); clear(Dxs2); clear(re1); printf("多项式相加请输入---1\n"); printf("多项式相减请输入---2\n"); printf("多项式相乘请输入---3\n"); printf("退出---------------4\n"); scanf("%d",&choose); switch(choose) { case 1: start(Dxs1,Dxs2); jia(Dxs1,Dxs2,re1); printf("两个多项式相加的结果: "); print_dxs(re1); break; case 2: start(Dxs1,Dxs2); jian(Dxs1,Dxs2,re1); printf("两个多项式相减的结果: "); print_dxs(re1); break; case 3: start(Dxs1,Dxs2); cheng(Dxs1,Dxs2,re1); printf("两个多项式相乘的结果: "); print_dxs(re1); break; case 4:exit(1);break; default: printf("错误!\n"); break; } } }
int main() { system("color f0"); shuoming(); short cuo=0; node *tou1=NULL,*tou2=NULL,* result=NULL; while(1) { do { cout<<"请选择功能:"<<endl; cin>>yunsuan; if(!cin) { cout<<"您输入的不是数字,请重新运行程序"<<endl; exit(0); }//if switch(yunsuan) { case 1:cuo=0;jia(tou1,tou2,result);break; case 2:cuo=0;jian(tou1,tou2,result);break; case 3:cuo=0;cheng(tou1,tou2,result);break; case 4:cuo=0;jifen(tou1,result);break; case 5:cuo=0;weifen(tou1,result);break; case 6:cuo=0;qiuzhi(tou1,result);break; case 7:cuo=0;init(tou1);cout<<"输入各项:"<<endl;cout<<"y="<<endl;fuzhi(tou1);outxu(tou1,result);break; default:cuo=1;cout<<"超出功能选择范围,请重新选择:"<<endl; }//switch } while(cuo==1);//do out(result); destory(tou1);destory(tou2);destory(result); short i=0; cout<<"是否清屏(1:是)(0:否):"; cin>>i; if(i==1) {system("cls");shuoming();} else cout<<"*********************"<<endl; }//while return 0; }
void main() { printf("sum is %d\n",jia(1,7)); }