bzoj1754 [Usaco2005 qua]Bull Math
题目
深夜水题第二弹,高精度乘法。
论三分钟打完。。
#include<bits/stdc++.h>
char s1[101],s2[101];
int l1,l2,l3;
int a[101],b[101],c[101];
int main()
{freopen("in.txt","r",stdin);gets(s1),gets(s2);while (s1[l1]>='0'&&s1[l1]<='9')l1++;while (s2[l2]>='0'&&s2[l2]<='9')l2++;for (int i=1;i<=l1;i++)a[l1-i+1]=s1[i-1]-'0';while (!a[l1])l1--;for (int i=1;i<=l2;i++)b[l2-i+1]=s2[i-1]-'0';while (!b[l2])l2--;for (int i=1;i<=l1;i++)for (int j=1;j<=l2;j++)c[i+j-1]+=a[i]*b[j];for (int i=1;i<=l1+l2+2;i++)while (c[i]>9)c[i]-=10,c[i+1]++;for (l3=l1+l2+3;l3;l3--)if (c[l3]) break;for (int i=l3;i>=1;i--)printf("%d",c[i]);return 0;
}
bzoj1754 [Usaco2005 qua]Bull Math相关推荐
- bzoj1754: [Usaco2005 qua]Bull Math
高精度乘法模板... #include<iostream> #include<cstdio> #include<cmath> #include<algorit ...
- [高精度乘法]BZOJ 1754 [Usaco2005 qua]Bull Math
模板题目,练练手~ #include <iostream> #include <algorithm> #include <cstring> #include < ...
- 【bzoj 1754】【POJ - 2389 】Bull Math (高精度运算)
题干: Bulls are so much better at math than the cows. They can multiply huge integers together and get ...
- **【POJ - 2389】 Bull Math (高精度乘法)
题干: Bulls are so much better at math than the cows. They can multiply huge integers together and get ...
- NUC1372 Bull Math【大数】
Bull Math 时间限制: 1000ms 内存限制: 65535KB 通过次数: 1总提交次数: 1 问题描述 Bulls are so much better at math than the ...
- poj2389 Bull Math (高精度之A*B)
题目来源:poj2389 Bull Math Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13350 Accepted ...
- 高精度乘法(正负数皆可(Bull Math)POJ)
描述 高精度乘法 输入:两行,每行表示一个非负整数(不超过10000位) 输出:两数的乘积. 样例1 样例输入1 99 101 样例输出1 9999 #include<iostream> ...
- POJ 2389 Bull Math(大数乘大数)
Description Bulls are so much better at math than the cows. They can multiply huge integers together ...
- POJ 2389 Bull Math(水~Java -大数相乘)
题目链接:http://poj.org/problem?id=2389 题目大意: 大数相乘. 解题思路: java BigInteger类解决 o.0 AC Code: 1 import java. ...
- bzoj 1753: [Usaco2005 qua]Who's in the Middle【排序】
--这可能是早年Pascal盛行的时候考排序的吧居然还是Glod-- #include<iostream> #include<cstdio> #include<algor ...
最新文章
- SVM原理详细图文教程来了!一行代码自动选择核函数
- HTTP权威指南阅读笔记五:Web服务器
- Asp.net細微的效率提升
- 第二章 Spark RDD以及编程接口
- .NET RulesEngine(规则引擎)
- 程序员情人节送这些!
- 顶配12599元!三星Galaxy S22国行价格来了...
- Gartner发布云产品评估报告:阿里云计算能力全球第一 1
- CENTOS 指定 yum 阿里云 源
- 人脸识别5.2- insightface人脸3d关键点检测,人脸68个特征点、106个特征点;人脸姿态角Pitch、Yaw、Roll、
- com.lowagie.itext pom 2.1.7.js6
- HTML音频视频、JS方法,以及插件使用教学
- 编写程序输入年利率k(例如2.52%),存款总额total(例如100000元),计算一年后的本息并输出。
- 职业定位测试/职业能力倾向测试
- 数据备份:备份文件/文件夹怎么操作?
- 什么是SEO?搜索引擎优化是什么意思?
- unity5.0 添加图片纹理
- Excel如何批量添加同一批注
- java软件工程师工作业绩_java工程师个人简历自我评价_JAVA软件工程师面试简历的自我评价...
- 中国企业应对金融危机三大秘诀