Sorry,坤哥,我们要用string了
2025-04-20 23:01:24
发布于:广东
1阅读
0回复
0点赞
我们
害怕
算法————
递归!!!!!!!!!!!!!!!
但我们
打倒递归:
#include<iostream>
#include<string>
using namespace std;
int main(){
string x;
cin>>x;
for(int i = 0;i < x.size();i++){
cout<<x[i]<<endl;
}
return 0;
}
对比递归(Copyright:古希腊掌管WA的神):
#include <bits/stdc++.h>
using namespace std;
int n;
void f(int x){
if (x == 0){
return;
}
f(x / 10);
cout << x % 10 << endl;
}
int main(){
cin >> n;
f(n);
return 0;
}
不知简单多少倍!!!
这里空空如也
有帮助,赞一个