当前位置:网站首页>Luogu_ P1303 A*B Problem_ High precision calculation
Luogu_ P1303 A*B Problem_ High precision calculation
2022-06-28 13:35:00 【This question AC sleep again】
Luogu _P1303 A*B Problem_ High precision calculation

//
#include<bits/stdc++.h>
using namespace std;
#define mem( a,v ) memset( a,v,sizeof( a ) )
const int N=11111; // RE
int main()
{
char a[N],b[N];
int ans[N];
int len,i,j;
mem( a,0 ); mem( b,0 ); mem( ans,0 ); // init
cin>>a>>b;
len=strlen(a)>strlen(b)?strlen(a):strlen(b);
reverse( a,a+strlen(a) );
reverse( b,b+strlen(b) );
for( i=0;a[i];i++ ) a[i]-='0';
for( i=0;b[i];i++ ) b[i]-='0';
for( i=0;i<len;i++ )
for( j=0;j<len;j++ )
ans[i+j]+=a[i]*b[j]; // Simulate manual calculation
for( i=0;i<len*2+5;i++ ) // carry
{
ans[i+1]+=ans[i]/10;
ans[i]%=10;
}
for( i=len*2+5;i && ans[i]==0;i-- );
for( ;~i;i-- ) cout<<ans[i];
cout<<endl;
return 0;
}边栏推荐
- 决策树预测红酒品质
- My hematemesis collection integrates script teaching from various classic shell books. As Xiaobai, come quickly
- Elastic box auto wrap demo
- Hematemesis recommends 17 "wheels" to improve development efficiency
- Oceanwide micro fh511 single chip microcomputer IC scheme small household appliances LED lighting MCU screen printing fh511
- Hubble数据库x某股份制商业银行:冠字号码管理系统升级,让每一张人民币都有 “身份证”
- 2022年中国运维安全产品市场规模及发展趋势预测分析
- Design artificial intelligence products: technical possibility, user acceptability and commercial feasibility
- PostgreSQL surpasses MySQL
- PostgreSQL超越MySQL
猜你喜欢

Hubble database x a joint-stock commercial bank: upgrade the number management system of Guanzi, so that every RMB has an "ID card"

PostgreSQL surpasses MySQL

Websocket automatically disconnects in 1 minute

MySQL多表联合查询

Commonly used "redmine" for # test bug

行动诠释价值,城联优品韩董事长出席广东英德抗洪捐赠公益活动会

Introduction to PWN (1) binary Basics

Setup and upload of arduino-esp32 flash file plug-in program

Oceanwide micro fh511 single chip microcomputer IC scheme small household appliances LED lighting MCU screen printing fh511

Pytorch model
随机推荐
泛海微FH511单片机IC方案小家电LED照明MCU丝印FH511
Data analysis - promoter evolution analysis
栅格矢量数据的裁剪
yii2编写swoole的websocket服务
List集合转数组
Jeecg 官方组件的使用笔记(更新中...)
PHP obtains the beginning and end time of the month according to the month and year
抢做意大利岛主?刘强东两月套现66亿 疑一次性5.6亿“紧急转账”急购欧洲海上皇宫
为什么新的5G标准将为技术栈带来更低的 TCO
Prediction of red wine quality by decision tree
The $980000 SaaS project failed
Oceanwide micro fh511 single chip microcomputer IC scheme small household appliances LED lighting MCU screen printing fh511
Mature case and source code of hash quiz game system development technology
移动Web实训DAY-2
Hubble数据库x某股份制商业银行:冠字号码管理系统升级,让每一张人民币都有 “身份证”
How to set auto format after saving code in vscade
iNFTnews | 科技巨头加快进军Web3和元宇宙
Recognize the startup function and find the user entry
完全背包 初学篇「建议收藏」
新品体验:阿里云新一代本地SSD实例i4开放公测