国产激情久久久久影院小草_国产91高跟丝袜_99精品视频99_三级真人片在线观看

大整數(shù)數(shù)相乘的問(wèn)題

時(shí)間:2020-11-23 18:57:26 筆試題目 我要投稿

大整數(shù)數(shù)相乘的問(wèn)題

  void Multiple(char A[], char B[], char C[]) {

  int TMP, In=0, LenA=-1, LenB=-1;

  while(A[++LenA] != ‘\0′);

  while(B[++LenB] != ‘\0′);

  int Index, Start = LenA + LenB – 1;

  for(int i=LenB-1; i>=0; i–) {

  Index = Start–;

  if(B[i] != ’0′) {

  for(int In=0, j=LenA-1; j>=0; j–) {

  TMP = (C[Index]-’0′) + (A[j]-’0′) * (B[i] – ’0′) + In;

  C[Index--] = TMP % 10 + ’0′;

  In = TMP / 10;

  }

  C[Index] = In + ’0′;

  }

  }

  }

  int main(int argc, char* argv[]) {

  char A[] = “21839244444444448880088888889″;

  char B[] = “38888888888899999999999999988″;

  char C[sizeof(A) + sizeof(B) - 1];

  for(int k=0; k C[k] = ’0′;

  C[sizeof(C)-1] = ‘\0′;

  Multiple(A, B, C);

  for(int i=0; C[i] != ‘\0′; i++)

  printf(“%c”, C[i]);

  }

【大整數(shù)數(shù)相乘的問(wèn)題】相關(guān)文章:

小學(xué)奧數(shù)數(shù)論問(wèn)題知識(shí)總結(jié):數(shù)的整除性規(guī)律10-06

單親兒童的10大心理問(wèn)題07-10

80后的四大心理問(wèn)題08-28

90后的八大心理問(wèn)題08-04

職業(yè)測(cè)評(píng)的六大問(wèn)題12-24

關(guān)于十大面試的問(wèn)題12-13

法國(guó)留學(xué)的八大問(wèn)題10-16

芭蕾舞大踢腿的注意問(wèn)題09-28

面試常見(jiàn)的五大問(wèn)題11-06