题解 | 23年OPPO-a的翻转

23年OPPO-a的翻转

https://www.nowcoder.com/practice/dcce2d0cc8f740c29e0885df96c9d625

//  #牛客春招刷题训练营# https://www.nowcoder.com/discuss/726480854079250432
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  string s;//---------以字符串形式读取A
  cin >> s;
  string ss = s;
  reverse(s.begin(), s.end());//----------------反转获得B
  long long a, b;
  a = stoi(s);//-------------把字符串转回数字
  b = stoi(ss);
  a += b;//--------相加,开ll防溢出
  cout << a;
  return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

09-24 18:25
门头沟学院 Java
点赞 评论 收藏
分享
09-19 12:15
门头沟学院 Java
猫头夜鹰:请问收到意向要点接受拒绝吗,还是开奖之后再接受拒绝
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务