题目

深夜水题第二弹,高精度乘法。

论三分钟打完。。

#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相关推荐

  1. bzoj1754: [Usaco2005 qua]Bull Math

    高精度乘法模板... #include<iostream> #include<cstdio> #include<cmath> #include<algorit ...

  2. [高精度乘法]BZOJ 1754 [Usaco2005 qua]Bull Math

    模板题目,练练手~ #include <iostream> #include <algorithm> #include <cstring> #include < ...

  3. 【bzoj 1754】【POJ - 2389 】Bull Math (高精度运算)

    题干: Bulls are so much better at math than the cows. They can multiply huge integers together and get ...

  4. **【POJ - 2389】 Bull Math (高精度乘法)

    题干: Bulls are so much better at math than the cows. They can multiply huge integers together and get ...

  5. NUC1372 Bull Math【大数】

    Bull Math 时间限制: 1000ms 内存限制: 65535KB 通过次数: 1总提交次数: 1 问题描述 Bulls are so much better at math than the ...

  6. poj2389 Bull Math (高精度之A*B)

    题目来源:poj2389 Bull Math Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13350   Accepted ...

  7. 高精度乘法(正负数皆可(Bull Math)POJ)

    描述 高精度乘法 输入:两行,每行表示一个非负整数(不超过10000位) 输出:两数的乘积. 样例1 样例输入1 99 101 样例输出1 9999 #include<iostream> ...

  8. POJ 2389 Bull Math(大数乘大数)

    Description Bulls are so much better at math than the cows. They can multiply huge integers together ...

  9. POJ 2389 Bull Math(水~Java -大数相乘)

    题目链接:http://poj.org/problem?id=2389 题目大意: 大数相乘. 解题思路: java BigInteger类解决 o.0 AC Code: 1 import java. ...

  10. bzoj 1753: [Usaco2005 qua]Who's in the Middle【排序】

    --这可能是早年Pascal盛行的时候考排序的吧居然还是Glod-- #include<iostream> #include<cstdio> #include<algor ...

最新文章

  1. SVM原理详细图文教程来了!一行代码自动选择核函数
  2. HTTP权威指南阅读笔记五:Web服务器
  3. Asp.net細微的效率提升
  4. 第二章 Spark RDD以及编程接口
  5. .NET RulesEngine(规则引擎)
  6. 程序员情人节送这些!
  7. 顶配12599元!三星Galaxy S22国行价格来了...
  8. Gartner发布云产品评估报告:阿里云计算能力全球第一 1
  9. CENTOS 指定 yum 阿里云 源
  10. 人脸识别5.2- insightface人脸3d关键点检测,人脸68个特征点、106个特征点;人脸姿态角Pitch、Yaw、Roll、
  11. com.lowagie.itext pom 2.1.7.js6
  12. HTML音频视频、JS方法,以及插件使用教学
  13. 编写程序输入年利率k(例如2.52%),存款总额total(例如100000元),计算一年后的本息并输出。
  14. 职业定位测试/职业能力倾向测试
  15. 数据备份:备份文件/文件夹怎么操作?
  16. 什么是SEO?搜索引擎优化是什么意思?
  17. unity5.0 添加图片纹理
  18. Excel如何批量添加同一批注
  19. java软件工程师工作业绩_java工程师个人简历自我评价_JAVA软件工程师面试简历的自我评价...
  20. 中国企业应对金融危机三大秘诀

热门文章

  1. 第六节 ftpserver的安装与配置(Windows)
  2. 纯HTML+CSS实现3D炫酷魔方(相册)
  3. 解决webView无法播放视频的问题
  4. 黑马程序员——Java基础--IO(一)
  5. 云信IM服务端API调用(THINKPHP版)
  6. Python OpenCv 实现实时人脸识别及面部距离测量
  7. python如何对excel批量加密_用python加密excel工作表
  8. 人可以活很多次,但是七年就是一辈子
  9. 7天从代码入门到开发应用,怎样快速提高代码能力?
  10. 为知笔记的快捷键整理