UVA - 10106 Product
来源:互联网 发布:犀牛软件分割模型 编辑:程序博客网 时间:2024/06/05 14:30
UVA - 10106 Product
题目大意:高精度的乘法
样例也出了,UVA的DEBUG也对比了,就是WA……占坑,过段时间看看能不能解决
#include<iostream>#include<cstring>#include<cstdio>using namespace std;int main() { char a[255] , b[255] ; int r[600]; int i , j , k , l1,l2 ,sav1 ; memset(a , '\0' ,sizeof(a)); memset(b , '\0' ,sizeof(b)); while( ~scanf("%s%s",a,b)) { l1 = 599; memset(r , 0 , sizeof(r)); for( i = 254 ; i >= 0 ; i-- ) { if( b[i] >= '0' && b[i] <='9') { l2 = l1; for(j = 254 ; j >= 0 ;j--) { if( a[j] >= '0' && a[j] <= '9' ) { k = l2; sav1 = ((int)(b[i]) - '0')*((int)(a[j])-'0'); while( sav1 !=0 ) { r[k] += sav1%10; k--; sav1 /= 10; } l2--; } } l1--; } } for( j = 599 ; j >=0;j--) { if(r[j] > 9 ) { r[j-1] += r[j]/10; r[j] = r[j]%10; } } i = 0; while( !r[i] && i < 600) { i++;} if(i == 600) cout << '0'; while( i < 600 ){ cout << r[i]; i++; } cout << endl; memset( a , '\0' , sizeof(a)); memset( b , '\0' , sizeof(b)); } return 0;}
0 0
- UVa 10106 Product
- UVa OJ 10106-Product
- Uva 10106 Product
- uva 10106 Product
- UVa 10106 - Product
- uva-10106 - Product
- UVA 10106 Product
- UVA 10106 - Product
- UVa 10106 - Product
- UVa 10106 - Product
- Uva 10106 - Product
- UVa 10106 - Product
- UVa - 10106 - Product
- UVA 10106 Product
- UVa 10106 - Product
- uva 10106 Product
- UVa 10106 Product (高精度)
- UVa 10106 - Product
- UVA - 409 Excuses, Excuses!
- NodeJs——(17)myblog的优化【2】用fs模块来记录访问情况
- UVA - 10115 Automatic Editing
- UVA - 10815 Andy's First Dictionary
- 51Nod-1105-第K大的数
- UVA - 10106 Product
- UVA - 424 Integer Inquiry
- UVA - 465 Overflow
- acdream 1007 a+b 快速幂取模
- UVA - 10879 Code Refactoring
- unity中跳跃的实现
- UVA - 10112 Myacm Triangles
- Android微信支付彻底扫坑
- java8--面向对象 上(疯狂java讲义3) 复习笔记