首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
cc12345
2025年3月20日 18:26
字符串翻转 题解:由于不会reverse,故采用swap交换位置
P1006
回复 0
|
赞 4
|
浏览 155
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int low=0; int high=s.length()-1; while(low<high) { swap(s[low],s[high]); low++; high--; } cout<<s; }
阿灿
2025年3月15日 03:05
字符串翻转 题解:string length
P1006
回复 0
|
赞 6
|
浏览 318
#include<bits/stdc++.h> using namespace std; int main(){ string a; int n; cin>>a; n = a.length(); while(n--){ cout<<a[n]; } return 0; }
zxjrheaven
2025年3月5日 21:26
字符串翻转 题解:假如你没听说过reverse()
P1006
回复 0
|
赞 16
|
浏览 432
//思路:倒序输出数组。 #include<bits/stdc++.h> using namespace std; int main() { char str[105]; scanf("%s",str); int num=strlen(str); for(int i=num-1;i>=0;i--) { ...
虚拟的世界
2025年2月16日 19:17
字符串翻转 题解:
P1006
回复 1
|
赞 2
|
浏览 377
这个编译器有问题?
固态氧化碳
2025年2月9日 15:43
字符串翻转 题解:fgets函数会读取换行符 注意字符串长度要多减一个
P1006
回复 0
|
赞 28
|
浏览 761
#include <stdio.h> #include <string.h> int main() { char s[1000]; fgets(s,sizeof(s),stdin); for(int i=strlen(s)-2;i>=0;i--) { printf("%c",s[i]); } }
xidianshangan
2025年1月1日 15:47
字符串翻转 题解:
P1006
回复 0
|
赞 1
|
浏览 367
print(input()[::-1])
ccccccyes
2024年8月21日 19:33
字符串翻转 题解:
P1006
回复 0
|
赞 13
|
浏览 887
#include <iostream> #include <algorithm> //reverse是algorithm中的 using namespace std; int main(){ string str; //string类详解 cin>>str; reverse(str.begin(),str.end());  ...
18919717626
2024年6月30日 15:21
字符串翻转 题解:getline
P1006
回复 1
|
赞 15
|
浏览 1.1k
#include <iostream> using namespace std; int main(){ string s; getline(cin,s); for(int i = s.size() - 1;i >= 0;i --){ cout << s[i]; } return 0; }
Candour
2024年4月19日 23:51
字符串翻转 题解:
P1006
回复 0
|
赞 6
|
浏览 742
#include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); reverse(s.begin(), s.end()); cout << s; return 0; }
kar
2024年3月26日 20:12
字符串翻转 题解:C++
P1006
回复 0
|
赞 8
|
浏览 1.0k
int main(){ string str; cin>>str; reverse(str.begin(),str.end()); cout<<str<<endl; return 0; }
1
2
3
4
题目
字符串翻转
题解数量
34
发布题解
在线答疑
热门题解
1
字符串翻转 题解:fgets函数会读取换行符 注意字符串长度要多减一个
2
字符串翻转 题解:
3
字符串翻转 题解:假如你没听说过reverse()
4
字符串翻转 题解:getline
5
字符串翻转 题解:
6
字符串翻转 题解:
7
字符串翻转 题解:C++
8
字符串翻转 题解:C
9
STL容器的逆序输出
10
字符串翻转 题解: