题解 | #整型存储# 按要求定义了一个类
整型存储
https://www.nowcoder.com/practice/5391e3118a5f419d8198264c5a8c805a
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
class solution{
public:
vector<pair<int,int>>ints;
bool input(int x){
if(ints.size()==10) return true;
string y=to_string(x);
reverse(y.begin(),y.end());
int x_reverse=stoi(y);
ints.push_back({x,x_reverse});
return false;
}
void print(){
for(pair it:ints){
cout<<it.first<<" "<<it.second<<endl;
}
}
};
int main() {
int x;
solution Solution;
while(cin>>x){
if(!x || Solution.input(x)){
Solution.print();
break;
}
}
}

叮咚买菜工作强度 218人发布