bzoj1754 [Usaco2005 qua]Bull Math
来源:互联网 发布:三毛作品 知乎 编辑:程序博客网 时间:2024/05/22 23:59
题目
深夜水题第二弹,高精度乘法。
论三分钟打完。。
#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;}
阅读全文
0 1
- bzoj1754 [Usaco2005 qua]Bull Math
- bzoj1754: [Usaco2005 qua]Bull Math
- bzoj1754 [Usaco2005 qua]Bull Math
- 1754: [Usaco2005 qua]Bull Math (高精度乘法)
- bzoj 1754: [Usaco2005 qua]Bull Math
- BZOJ 1754: [Usaco2005 qua]Bull Math 高精乘
- Bull Math
- bzoj1755 [Usaco2005 qua]Bank Interest
- 1755: [Usaco2005 qua]Bank Interest
- bzoj1751 [Usaco2005 qua]Lake Counting
- bzoj1750 [Usaco2005 qua]Apple Catching
- bzoj1755 [Usaco2005 qua]Bank Interest
- bzoj1751 [Usaco2005 qua]Lake Counting
- [bzoj1751][Usaco2005 qua]Lake Counting
- bzoj1755 [Usaco2005 qua]Bank Interest
- 1751: [Usaco2005 qua]Lake Counting (搜索)
- 1750: [Usaco2005 qua]Apple Catching (动态规划)
- bzoj 1751 [Usaco2005 qua]Lake Counting
- C\C++语言题库
- jenkins 重启方法
- 算法分析与设计week03--122.Best Time to Buy and Sell Stock II
- [记录] Vmware14安装/升级macOS10.13后无法正常全屏的问题
- HTML5标签
- bzoj1754 [Usaco2005 qua]Bull Math
- 创新性组织(笔记)
- java运算符
- vue2.0组件之间的通信
- Java代码发送Http请求
- 41. First Missing Positive
- 经典递归问题回顾——汉诺塔
- 动态创建Lambda表达式实现高级查询
- bzoj1753 [Usaco2005 qua]Who's in the Middle