如果这次noip没考好,完全是因为从7月29日之后就没有再写过程序了。说起来,真是一个泪流满面的事实…

那这样一个弱智题练手恢复代码能力,竟然还花了我两个晚上(当然不是两整个晚上…)

第一天TLE了,好在我机智,一看到解题里说要压位就自动脑补出压位了。

代码风格非常诡异,弱智题竟然写到2KB我也是醉了。

program vijos_p1040;
const maxn=;
var a,b,aa,bb:array[..maxn] of integer;
c:array[..*maxn] of integer;
ma,mb,i,j,t,ca,cb:integer;
ch:char;
begin
//assign(input,'himul.in4');reset(input);
//assign(output,'himul.ou4');rewrite(output);
i:=;
//input num a
while not eoln do
begin
read(ch);
inc(i);
a[i]:=ord(ch)-ord('');
end;
ma:=i;
readln;
//reverse num a
for i:= to ma div do
begin
t:=a[i];a[i]:=a[ma-i+];a[ma-i+]:=t;
end;
//compress num a
for i:= to (ma div )+ do
aa[i]:=a[*i-]+a[*i]*;
//input num b
i:=;
while not eoln do
begin
read(ch);
inc(i);
b[i]:=ord(ch)-ord('');
end;
mb:=i;
//reverse num b
for i:= to mb div do
begin
t:=b[i];b[i]:=b[mb-i+];b[mb-i+]:=t;
end;
for i:= to (mb div )+ do
bb[i]:=b[*i-]+b[*i]*;
//multi
ca:=ma div +;
cb:=mb div +;
for i:= to cb do
begin
for j:= to ca do
begin
c[i+j-]:=c[i+j-]+aa[j]*bb[i];
if c[i+j-]>= then
begin
c[i+j]:=c[i+j]+c[i+j-] div ;
c[i+j-]:=c[i+j-] mod ;
end;
end;
end;
j:=ca+cb+;
while c[j]= do dec(j);
write(c[j]);
for i:=j- downto do
begin
if c[i]>= then write(c[i]) else write('',c[i]);
end;
writeln;
//close(input);close(output);
end.

高精度乘法

测试数据 #0: Accepted, time = 0 ms, mem = 732 KiB, score = 25

测试数据 #1: Accepted, time = 15 ms, mem = 732 KiB, score = 25

测试数据 #2: Accepted, time = 15 ms, mem = 736 KiB, score = 25

测试数据 #3: Accepted, time = 608 ms, mem = 732 KiB, score = 25

[vijos P1040] 高精度乘法的更多相关文章

  1. Vijos 1040 高精度乘法

    描述 高精度乘法 输入:两行,每行表示一个非负整数(不超过10000位) 输出:两数的乘积. 样例1 样例输入1 99 101 样例输出1 9999 题解 这道题和之前的Vijos 1010 清帝之惑 ...

  2. 【PKU1001】Exponentiation(高精度乘法)

    Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 145642   Accepted: 35529 ...

  3. hdu 1042 N!(高精度乘法 + 缩进)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1042 题目大意:求n!, n 的上限是10000. 解题思路:高精度乘法 , 因为数据量比较大, 所以 ...

  4. hdu 1042 N!(高精度乘法)

    Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in ...

  5. 【POJ 1001】Exponentiation (高精度乘法+快速幂)

    BUPT2017 wintertraining(15) #6A 题意 求\(R^n\) ( 0.0 < R < 99.999 )(0 < n <= 25) 题解 将R用字符串读 ...

  6. [leetcode]43. Multiply Strings高精度乘法

    Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and ...

  7. H. GSS and Simple Math Problem 高精度乘法模板

    链接:https://www.nowcoder.com/acm/contest/104/G来源:牛客网 题目描述 Given n positive integers , your task is to ...

  8. 高精度乘法--C++

    高精度乘法--C++ 模仿竖式乘法,在第一步计算的时候将进位保留,第一步计算完再处理进位.(见代码注释) 若要处理正负情况,可在数据输入后加以判断,处理比较简单. 小数计算也可参照该方法,不过对齐方式 ...

  9. C语言高精度乘法

    #include <stdio.h> void highPrecision (int N ); ] = {, }, length = ; //开辟一个大的数组,全局变量length记录长度 ...

随机推荐

  1. Generate Time Data(财务日期主数据)

        1. Generate the master data from the specific time frame that you are interested in根据你输入的时间段来产生主 ...

  2. Linux-设置固定IP

    第一步:激活网卡 系统装好后默认的网卡是eth0,用下面的命令将这块网卡激活. # ifconfig eth0 up 第二步:设置网卡进入系统时启动 想要每次开机就可以自动获取IP地址上网,就要设置网 ...

  3. 关于如何使用Identity的文献

    有几篇文件,深入浅出地讲解了如何一步一步的使用Identity,感觉十分有用,留下链接,备查. 1. Configuring Db Connection and Code-First Migratio ...

  4. 配置appium 1.6.3 for MAC

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #454545 } 安装 ...

  5. Scrapy--1安装和运行

    1.Scrapy安装问题 一开始是按照官方文档上直接用pip安装的,创建项目的时候并没有报错, 然而在运行 scrapy crawl dmoz 的时候错误百粗/(ㄒoㄒ)/~~比如: ImportEr ...

  6. BeautifulSoup学习笔记

    1.如果tag最内层只有一个 NavigableString 类型子节点,那么这个tag可以直接使用tag.string 得到子节点 # encoding=utf-8 from bs4 import ...

  7. jmeter Transaction Controller学习

    测试计划组成:一个计时器(2秒),一个事物控制器,两个http request 在Transaction Controller中不勾选第2个选项就相当于lr中的忽略思考时间 没有勾选第2项的执行结果: ...

  8. Oracle 乱码

    导入DMP之后 ..... 1.Oacle数据库表中数据乱码 请检查导出DMP的ORACLE数据库编码设置 修改ORACLE编码与原DMP导出编码一致 select userenv('language ...

  9. 安装pear

    下载go-pear.phar php go-pear.phar pear install Mail-1.2.0 pear list

  10. 浅谈对Js闭包的理解

    理解Js的闭包,首先让我们先看几个概念 执行环境(executive environment)每个函数都有自己的执行环境,匿名函数默认为全局环境. 作用域链(scope chain)子函数继承父函数, ...