Nyoj 844 A+B Problem[字符串逆序]
来源:互联网 发布:编程笔记本配置要求 编辑:程序博客网 时间:2024/06/09 22:41
题目连接:点击打开链接
网上啥啥都特别乱,自己看了点,直接自己写了个被称为原地逆序。
void ABBA(char a[])
{
int left=0,right=strlen(a)-1;
while(left<=right)
{
swap(a[left],a[right]);
left++;
right--;
}
}
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<algorithm>using namespace std;const int N=15;void ABBA(char a[]){ int left=0,right=strlen(a)-1; while(left<=right) { swap(a[left],a[right]); left++; right--; }}int main(){ char a[N],b[N]; while(~scanf("%s%s",a,b)) { int alen=strlen(a),blen=strlen(b); if(alen==1&&a[0]=='0'&&blen==1&&b[0]=='0') return 0; ABBA(a);ABBA(b); printf("%d\n",atoi(a)+atoi(b)); }}这里补充两个函数:
atoi();点击打开链接
atif();点击打开链接
很是受用。
- Nyoj 844 A+B Problem[字符串逆序]
- NYOJ - A*B Problem
- NYOJ - A-B Problem
- NYoj A*B Problem
- NYOJ-A^B Problem
- NYOJ-A/B Problem
- NYOJ A-B Problem
- NYOJ A-B Problem
- nyoj-844-A+B Problem(V)
- NYOJ 844 A+B Problem(V)
- NYOJ 844 A+B Problem(V)
- NYOJ-844 A+B Problem(V)
- nyoj 844 A+B Problem(V)
- NYOJ 844 A+B Problem(V)
- NYOJ 844 A+B Problem(V)
- NYOJ 844 A+B Problem(V)
- NYOJ 844 A+B Problem(V)
- NYOJ 844 A+B Problem(V)
- struts2中action接收参数的方法
- c++11 右值引用
- 我读过的最好的epoll讲解--转自”知乎“
- SD卡引脚 电路图及工作原理介绍 .
- 冒泡法 应用排序
- Nyoj 844 A+B Problem[字符串逆序]
- c++ 关键字 总结(63个)
- mysql查看端口
- linux下基于jrtplib库的实时传送实现
- 甲骨文封闭MySQL 谷歌转向分支MariaDB
- C# 新浪微博模拟登录
- MongoDB成为首位10亿美元初创,功臣可归功于Oracle?
- 关于定义a:visited后a:hover不起作用
- k均值聚类(K-means)相异度计算