如果这次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. IIS设置session时长

    打开IIS管理器,选择要设置的session的网站,打开右边窗口的会话状态.选择状态服务器,设置连接字符串,并在服务管理开户状态服务 ASP.NET State Service

  2. hihoCoder 1425 : What a Beautiful Lake(美丽滴湖)

    hihoCoder #1425 : What a Beautiful Lake(美丽滴湖) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - 题目描述 ...

  3. docker compose 笔记

    https://www.youtube.com/watch?v=Uez88TWOECg 是基于这个视频做的笔记. Docker Compose: Compose is a tool for defin ...

  4. DuiLib 源码分析之CDuiString

    duilib是一个比较常见的界面库,闲来无事看看别人写的代码,跟自己写的一比, 才看到了差距呀,感觉自己写的乱七八糟,keep moving CduiString是duilib提供的一个字符串类,功能 ...

  5. WebUpLoder 能自动预览,能多实例,包括后台demo

    样式在网上找的.样子: 懒得写别的了,代码里面我写的注释挺详细的:https://github.com/zhangsai521314/WebUpLoder 写文不易,转载请注明出处:http://ww ...

  6. 动态代理proxy与CGLib的区别

    什么是代理? 静态代理与动态代理 静态代理实例 JDK动态代理实例 CGLib 简介 CGLib 与JDK动态代理的区别 代理模式是Java中常见的一种模式,英文名字叫走Proxy或者Surrogat ...

  7. golang os/exec 执行外部命令

    exec包执行外部命令,它将os.StartProcess进行包装使得它更容易映射到stdin和stdout,并且利用pipe连接i/o. func LookPath(file string) (st ...

  8. Spring基于注解ehCache缓存整合

    注解的使用参照:http://blog.csdn.net/wjacketcn/article/details/50945887 (侵删) ehCache是纯java实现的缓存组件,spring从3.1 ...

  9. javascript学习内容--object.style.display="value" value值为“”none“隐藏”或 "block"显示

    <head> var mychar=document.getElementById("con"); function hidden(){ mychar.style.di ...

  10. BIOS MCSDK 2.0 学习笔记(一)

    MCSDK简介 BIOS MCSDK是为TI的高性能多核DSP提供的一套组件,包括: SYS/BIOS实时操作系统 Chip support libraries, drivers, and basic ...