Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <deque>
- #include <algorithm>
- #include <string>
- #include <vector>
- using namespace std;
- int BrCifara (const int &n) {
- int temp{n}, br_cifara{0};
- while (temp!=0) {
- temp/=10;
- br_cifara++;
- }
- return br_cifara;
- }
- bool Kriterij (const int &a, const int &b) {
- if (BrCifara(a)==BrCifara(b)) return a>b;
- else return BrCifara(a)<BrCifara(b);
- }
- int main () {
- deque<int> d(0);
- for (int i=0; i<5; i++) {
- int n; cin>>n; d.push_back(n);
- }
- sort(d.begin(), d.end(), Kriterij);
- for (auto x: d) cout<<x<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement