文章

5

粉丝

141

获赞

4

访问

37.2k

头像
利用sscanf()实现
P1003 兰州大学机试题
发布于2021年6月15日 19:34
阅读数 7.8k

#include <stdio.h>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int m,n;
    string s1,s2;
    while(cin>>s1>>s2){
        reverse(s1.begin(),s1.end());
        reverse(s2.begin(),s2.end());
        sscanf(s1.c_str(),"%d",&m);
        sscanf(s2.c_str(),"%d",&n);
        cout<<m+n<<endl;
    }
    return 0;
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发