3 条题解
-
12230134娄耀 (2212238) LV 8 @ 2023-05-13 07:58:41
#include<bits/stdc++.h> using namespace std; struct st { int zheng,fan; }a[105]; int x,y,l=1; bool cp(st a,st b) { return a.fan<b.fan; } int main() { cin>>x>>y; int n=y-x+1; for(int i=x;i<=y;i++) { a[l].zheng=i; int it=i; while(it) { a[l].fan=a[l].fan*10+it%10; it/=10; } l++; } sort(a+1,a+n+1,cp); for(int i=1;i<=n;i++) cout<<a[i].zheng<<endl; return 0; }
-
02021-11-14 13:44:26@
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>using namespace std;
vector<int> a;
int n, m;int goback(int x)
{
int res = 0;
while ( x ) res = res * 10 + x % 10, x /= 10;
return res;
}void qusort(int l, int r)
{
int num = a.size();
for ( int i = 0; i < num - 1; i ++ )
for ( int j = i + 1; j < num; j ++ )
if ( goback(a[i]) > goback(a[j]) ) swap(a[i], a[j]);
}int main()
{
scanf("%d%d", &n, &m);
for ( int i = n; i <= m; i ++ ) a.push_back(i);qusort(0, n - m + 1);
for_each(a.begin(), a.end(), { printf("%d\n", x);});
return 0;
} -
02021-11-01 21:35:29@
#pragma GCC optimize(2) #pragma GCC optimize(3) #include <cstdio> #include <vector> #include <cstring> #include <iostream> #include <algorithm> using namespace std; vector<int> a; int n, m; int goback(int x) { int res = 0; while ( x ) res = res * 10 + x % 10, x /= 10; return res; } void qusort(int l, int r) { int num = a.size(); for ( int i = 0; i < num - 1; i ++ ) for ( int j = i + 1; j < num; j ++ ) if ( goback(a[i]) > goback(a[j]) ) swap(a[i], a[j]); } int main() { scanf("%d%d", &n, &m); for ( int i = n; i <= m; i ++ ) a.push_back(i); qusort(0, n - m + 1); for_each(a.begin(), a.end(), [](int x){ printf("%d\n", x);}); return 0; }
- 1
信息
- ID
- 2424
- 难度
- 4
- 分类
- (无)
- 标签
- 递交数
- 79
- 已通过
- 33
- 通过率
- 42%
- 被复制
- 5
- 上传者