高精乘法板子

然而WA了两次也是没救了

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=105;
int la,lb,lc,a[N],b[N],c[N],tot;
char ch[N];
int main()
{
scanf("%s",ch+1);
la=strlen(ch+1);
for(int i=1;i<=la;i++)
a[i]=ch[la-i+1]-'0';
scanf("%s",ch+1);
lb=strlen(ch+1);
for(int i=1;i<=lb;i++)
b[i]=ch[lb-i+1]-'0';
for(int i=1;i<=la;i++)
for(int j=1;j<=lb;j++)
c[i+j-1]+=a[i]*b[j];
for(int i=1;i<=la+lb;i++)
{
c[i+1]+=c[i]/10;
c[i]%=10;
if(c[i])
lc=i;
}
for(int i=lc;i;i--)
printf("%d",c[i]);
return 0;
}
/*
11111111111111
1111111111
*/

bzoj 1754: [Usaco2005 qua]Bull Math【高精乘法】的更多相关文章

  1. BZOJ 1754: [Usaco2005 qua]Bull Math

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

  2. 1754: [Usaco2005 qua]Bull Math

    1754: [Usaco2005 qua]Bull Math Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 398  Solved: 242[Submit ...

  3. 【BZOJ】1754: [Usaco2005 qua]Bull Math

    [算法]高精度乘法 #include<cstdio> #include<algorithm> #include<cstring> using namespace s ...

  4. BZOJ1754: [Usaco2005 qua]Bull Math

    1754: [Usaco2005 qua]Bull Math Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 374  Solved: 227[Submit ...

  5. bzoj 3287: Mato的刷屏计划 高精水题 && bzoj AC150

    3287: Mato的刷屏计划 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 124  Solved: 43[Submit][Status] Desc ...

  6. bzoj 1755: [Usaco2005 qua]Bank Interest【模拟】

    原来强行转int可以避免四舍五入啊 #include<iostream> #include<cstdio> using namespace std; int r,y; doub ...

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

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

  8. vj1010:高精乘+细心模拟

    这题的话思路挺简单的,主要是打一个高精乘,然后考虑一些细节的东西 码得挺少时间的,但是调错调了很久... 讲一下思路吧: 就是读入的时候,先把小数点去掉,mark一下小数点的位置 去掉小数点之后也就进 ...

  9. 【题解】洛谷P1066 [NOIP2006TG] 2^k进制数(复杂高精+组合推导)

    洛谷P1066:https://www.luogu.org/problemnew/show/P1066 思路 挺难的一道题 也很复杂 满足题目要求的种数是两类组合数之和 r的最多位数m为 w/k(当w ...

随机推荐

  1. java 通过反射机制调用某个类的方法

    package net.xsoftlab.baike; import java.lang.reflect.Method; public class TestReflect {     public s ...

  2. spring+orm框架的兼容问题

    Springframework和Hibernate版本对应关系 org.springframework 3.0.x对应org.hibernate4.0.x版本 org.springframework ...

  3. 恢复表数据的办法(delete删除可恢复,truncate不可恢复)

    select * from table_name as of timestamp to_timestamp('2018-12-20 00:00:00', 'yyyy-mm-dd hh24:mi:ss' ...

  4. 应用CLR的线程池

    大家都知道这个线程的建立和销毁都需要很大的性能开销,当有比较多且不同的任务需要完成时,可以考虑使用线程池来管理这些线程.在以windows NT为内核的操作系统上每个进程都包含一个线程池,在线程池中存 ...

  5. 基于 Java 的开源网络爬虫框架 WebCollector

    原文:https://www.oschina.net/p/webcollector

  6. linux程序命令行选项的3种风格:unix、gnu、x toolkit

    In Unix-like systems, the ASCII hyphen-minus is commonly used to specify options. The character is u ...

  7. ubuntu下进行ssh

    ubuntu下进行ssh   一, 介绍         SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定:SSH 为建立 ...

  8. Mysql中错误日志、binlog日志、查询日志、慢查询日志简单介绍

    前言 数据库的日志是帮助数据库管理员,追踪分析数据库以前发生的各种事件的有力根据.mysql中提供了错误日志.binlog日志(二进制日志).查处日志.慢查询日志.在此,我力求解决下面问题:各个日志的 ...

  9. JSP自己定义标签入门实例具体解释

    JSP自己定义标签主要能用到的两个包 javax.servlet.jsp.*;javax.servlet.jsp.tagext.*; 自己定义标签<userInfo:showUserInfo/& ...

  10. Office 佳能MP259打印EXCEL线条歪曲,字迹模糊怎么办

    这大概是墨盒的缘故,判断方法很简单,随便找一个文档,点击打印,属性   在维护选项卡中把清洗和打印头对齐做一遍(一般字迹模糊可以通过清洗解决,线条歪曲可以通过打印头对齐解决),如果你打印的结果是纸张边 ...