高精乘法板子

然而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. 【Kafka问题解决】Connection to xxx could not be established. Broker may not be available.

    请检查Kafka的config/server.properties 看看是否有填写 listeners=PLAINTEXT://kafka-host:9092 advertised.listeners ...

  2. prometheus监控mysql

    创建一个用于mysqld_exporter连接到MySQL的用户并赋予所需的权限 mysql> GRANT REPLICATION CLIENT, PROCESS ON *.* TO '; my ...

  3. set/multiset用法详解

    集合 使用set或multiset之前,必须加入头文件<set> Set.multiset都是集合类,差别在与set中不允许有重复元素,multiset中允许有重复元素. sets和mul ...

  4. dynamic-imports & web components & html dynamic import

    dynamic-imports web components & html dynamic import https://github.com/webcomponents/html-impor ...

  5. Discuz! X2.5数据库字典【转载】

    DROP TABLE IF EXISTS pre_common_admincp_cmenu; CREATE TABLE pre_common_admincp_cmenu ( `id` SMALLINT ...

  6. Nginx+Tomcat+Memcached负载均衡和session共享

    1. 演示搭建 说明:本文参考网络日志http://blog.csdn.net/remote_roamer/article/details/51133790,结合实际操作,仅做个演示记录. 1.1.  ...

  7. uva 1411 Ants (权值和最小的完美匹配---KM算法)

    uva 1411 Ants Description Young naturalist Bill studies ants in school. His ants feed on plant-louse ...

  8. golang 中可变参数的个数

    package main import "fmt" func Greeting(prefix string, who ... string) { fmt.Println(prefi ...

  9. CSS 全部的列表样式类型

    <html> <head> <style type="text/css"> ul.none {list-style-type: none} ul ...

  10. C - The C Answer (2nd Edition) - Exercise 1-8

    /* Write a program to count blanks, tabs, and newlines. */ #include <stdio.h> /* count blanks, ...