A+B Problem!

通过模拟我故乡非洲的计算方式,我们很快可以解决这道题。

 #include<iostream>
#include<cstdio>
#include<cmath>
int main(){
int i,j;
int a,b;
scanf("%d%d",&a,&b);
int sum=;
for(i=;i<=a;i++)sum++;
for(j=;j<=b;j++)sum++;
std::cout<<sum<<std::endl;
return ;
}

其实我就是想存个高精度模板

 struct num
{
int l,a[];
num operator + (const num &x) const
{
num ans;
int len;
memset(ans.a,,sizeof(ans.a));
for (int i=;i<=l||i<=x.l;i++)
{
ans.a[i]+=a[i]+x.a[i];
ans.a[i+]+=ans.a[i]/;
ans.a[i]%=;
}
if (l<x.l) len=x.l+;
else len=l+;
while (!ans.a[len]&&len) len--;
ans.l=len;
return ans;
}
}
 void prt(num x)
{
printf("%d",x.a[x.l]);
for (int i=x.l-;i>=;i--)
{
int y=x.a[i];
if (y<) printf("");
if (y<) printf("");
if (y<) printf("");
printf("%d",y);
}
}

TYVJ1000 A+B problem [存个高精模板]的更多相关文章

  1. C++中,用类和重载运算符写高精模板

    先放代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; s ...

  2. 题解 P1601 【A+B Problem(高精)】

    P1601 A+B Problem(高精) 题目描述 高精度加法,x相当于a+b problem,b不用考虑负数. 输入输出格式 输入格式: 分两行输入a,b<=10^500 输出格式: 输出只 ...

  3. 【洛谷P1601 A+B Problem(高精)】

    题目背景 无 题目描述 高精度加法,x相当于a+b problem,[b][color=red]不用考虑负数[/color][/b] 输入输出格式 输入格式: 分两行输入a,b<=10^500 ...

  4. 【洛谷p1601】A+B Problem(高精)

    高精度加法的思路还是很简单容易理解的 A+B Problem(高精)[传送门] 洛谷算法标签: 附上代码(最近懒得一批) #include<iostream> #include<cs ...

  5. 洛谷1601 A+B Problem(高精) 解题报告

    洛谷1601 A+B Problem(高精) 本题地址:http://www.luogu.org/problem/show?pid=1601 题目背景 无 题目描述 高精度加法,x相当于a+b pro ...

  6. 洛谷 P1601 A+B Problem(高精)

    P1601 A+B Problem(高精) 题目背景 无 题目描述 高精度加法,x相当于a+b problem,[b][color=red]不用考虑负数[/color][/b] 输入输出格式 输入格式 ...

  7. BZOJ_1002_[FJOI2007]_轮状病毒_(递推+高精)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1002 )*&*(^&*^&*^**()*) 1002: [FJOI20 ...

  8. BZOJ.1210.[HNOI2004]邮递员(插头DP Hash 高精)

    BZOJ 洛谷 http://www.cnblogs.com/LadyLex/p/7326874.html 插头DP.\(m+1\)个插头的状态需要用三进制表示:\(0\)表示无插头,\(1\)表示是 ...

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

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

随机推荐

  1. 使用appscan实现多站扫描简单自动化

    因为appscan在新建扫描任务的时候只能输入一个target,并且没有awvs/nessus那样提供web接口,导致我以前一直以为appscan不能像awvs那样批量建立任务自动扫描. 不过,今天要 ...

  2. 性能测试一般过程与LR性能测试过程

    性能测试作为测试分类的一个大类,等同于系统测试中的功能测试.安全性测试和配置测试等,因此她的测试过程是对整个测试类型中测试过程的一个描述,因此包含了测试需要的确认目标,熟悉系统.获得需求等部分,因此性 ...

  3. Apache Shiro(安全框架)

    当前常用流行的安全框架主要有两种:一个是Apache Shiro:另一个是Springsource. 现在介绍一下apache shiro: 既然是安全框架,解决的肯定是权限的 控制.所谓权限是指:用 ...

  4. action中result没有值

    action中result没有值,访问action会输出action中的所有数据,输出类型为.action类型 .

  5. Android Animation简述

    Android Animation简述 一.动画(Animation)          Android框架提供了两种动画系统:属性动画(Android3.0)和视图动画.同时使用两种动画是可行的,但 ...

  6. C/C++关于string.h头文件和string类

    学习C语言时,用字符串的函数例如stpcpy().strcat().strcmp()等,要包含头文件string.h 学习C++后,C++有字符串的标准类string,string类也有很多方法,用s ...

  7. 逆向最大匹配分词算法C#

    逆向顺序 句子:大家好我叫XX我是一名程序员 程序员 -> 序员 -> 员 名程序 -> 程序 -> 序 一名程 -> 名程 -> 程 是一名 -> 一名 - ...

  8. memcached协议

    memcached协议 旧版:http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt 新版:https://githu ...

  9. Linux第七次实验笔记

    #期中总结 习题总结与分析 填空:Linux Bash中,Ctrl+a快捷键的作用是(将光标移至输入行头,相当于Home键). [ctrl]+u 从游标处向前删除指令串 [ctrl]+k 从游标处向后 ...

  10. Pjax.js防刷新技术

    自我感觉良好,所以拿出现在自己用的 Pjax.js 分享给大家 当然 这个版本是 经过本人修改后的版本,跟其它 拿过来就用的 不一样 而且区别还不小 大多的 Pjax 都是 跟后台无关的,而这个版本是 ...