博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
太弱了。。水题
阅读量:4047 次
发布时间:2019-05-25

本文共 898 字,大约阅读时间需要 2 分钟。

HDU 1002

没谁了。。。
不过,sscanf很重要!!!!!!!!!!!!!!!

#include
#include
#include
#include
using namespace std;int main(){ char a[20],b[20]; while(scanf("%s%s",a,b)!=EOF) { int t1=0,t2=0; double s1,s2; if(a[0]=='-') t1=1; if(b[0]=='-') t2=1; int la=strlen(a),lb=strlen(b); int l1=0,l2=0; for(int i=0; i
='0'&&a[i]<='9') a[l1++]=a[i]; a[l1]='\0'; for(int i=0; i
='0'&&b[i]<='9') b[l2++]=b[i]; b[l2]='\0'; s1=a[0]-'0'; s2=b[0]-'0'; for(int i=1; i
int main(){ char str1[15],str2[15]; char s1[15],s2[15]; while(~scanf("%s%s",str1,str2)) { int k=0; for(int i=0;str1[i];i++) { if(str1[i]!=',') s1[k++]=str1[i]; } s1[k]=0; k=0; for(int i=0;str2[i];i++) { if(str2[i]!=',') s2[k++]=str2[i]; } s2[k]=0; int a,b; sscanf(s1,"%d",&a); sscanf(s2,"%d",&b); printf("%d\n",a+b); } return 0;}

转载地址:http://fjbci.baihongyu.com/

你可能感兴趣的文章
zookeeper
查看>>
Idea导入的工程看不到src等代码
查看>>
技术栈
查看>>
Jenkins中shell-script执行报错sh: line 2: npm: command not found
查看>>
8.X版本的node打包时,gulp命令报错 require.extensions.hasownproperty
查看>>
Jenkins 启动命令
查看>>
Maven项目版本继承 – 我必须指定父版本?
查看>>
通过C++反射实现C++与任意脚本(lua、js等)的交互(二)
查看>>
利用清华镜像站解决pip超时问题
查看>>
微信小程序开发全线记录
查看>>
CCF 分蛋糕
查看>>
解决python2.7中UnicodeEncodeError
查看>>
小谈python 输出
查看>>
Django objects.all()、objects.get()与objects.filter()之间的区别介绍
查看>>
python:如何将excel文件转化成CSV格式
查看>>
机器学习实战之决策树(一)
查看>>
机器学习实战之决策树二
查看>>
[LeetCode By Python]7 Reverse Integer
查看>>
[LeetCode By Python]121. Best Time to Buy and Sell Stock
查看>>
[LeetCode By Python]122. Best Time to Buy and Sell Stock II
查看>>