九度OJ 1003:A+B
来源:互联网 发布:python xrang 编辑:程序博客网 时间:2024/05/27 20:27
/*******************
题目:九度OJ 1003:A+B
作者:xiaohanstu
日期:2013-11-2
语言: C++
思路:先将A,B字符串中的逗号去掉,
再用atoi函数将其转换成整型相加即可;
结果:AC
*******************/
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
int main()
{
string A,B;
while(cin>>A>>B)
{
char shuzuA[20],shuzuB[20];
memset(shuzuA,'A',20);
memset(shuzuB,'A',20);
for(int i=0,j=0;i<A.length();++i)
{
if(','==A[i])
continue;
else
{
shuzuA[j]=A[i];
j++;
}
}
int shuA=atoi(shuzuA);
for(int i=0,j=0;i<B.length();++i)
{
if(','==B[i])
continue;
else
{
shuzuB[j]=B[i];
j++;
}
}
int shuB=atoi(shuzuB);
cout<<shuA+shuB<<endl;
}
return 1;
}
题目:九度OJ 1003:A+B
作者:xiaohanstu
日期:2013-11-2
语言: C++
思路:先将A,B字符串中的逗号去掉,
再用atoi函数将其转换成整型相加即可;
结果:AC
*******************/
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
int main()
{
string A,B;
while(cin>>A>>B)
{
char shuzuA[20],shuzuB[20];
memset(shuzuA,'A',20);
memset(shuzuB,'A',20);
for(int i=0,j=0;i<A.length();++i)
{
if(','==A[i])
continue;
else
{
shuzuA[j]=A[i];
j++;
}
}
int shuA=atoi(shuzuA);
for(int i=0,j=0;i<B.length();++i)
{
if(','==B[i])
continue;
else
{
shuzuB[j]=B[i];
j++;
}
}
int shuB=atoi(shuzuB);
cout<<shuA+shuB<<endl;
}
return 1;
}
- 九度OJ 1003 A+B
- 九度OJ 1003:A+B
- 九度OJ 题目1003:A+B
- 九度OJ题目1003:A+B
- 九度 OJ 1003 A+B
- 九度OJ 题目1003:A+B
- 九度OJ-题目1003:A+B
- 九度OJ 1003:A+B
- 九度OJ 1003:A+B
- 九度OJ-1003:A+B
- 九度OJ-题目1003 A+B
- 九度OJ题目1003:A+B
- A + B 九度oj
- 【九度OJ】1003【A+B系列2010】
- a+b (九度oj 题目60)
- 九度OJ 题目1010:A + B
- 九度OJ 1010 A+B
- 九度OJ---还是A+B
- KVO/KVC做了简单的介绍
- 基于antlr的表达式解析器——函数生成(通过freemarker)
- 干大事的从来不要脸!
- Android UI系列:EditText输入框
- 05-DIV+CSS-引入
- 九度OJ 1003:A+B
- 另外五个 PHP 设计模式
- C/C++代码实现图(有向图)的深度,广度优先遍历
- 正则表达式(全)
- 【PAT Advanced Level】1016. Phone Bills (25)
- eclipse调试hadoop2.2.0源码笔记
- 第十一章
- 表单校验html+js
- 优化PHP代码的40条建议