Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- short int v[10];
- int pn(int z) {
- while (z >= 10)
- z /= 10;
- return z;
- }
- int main() {
- ifstream f("numere.in");
- ofstream g("numere.out");
- long long x;
- int n, y, ok = 0;
- f >> n >> x;
- v[pn(x)]++;
- for (int i = 2; i <= n; i++) {
- y = x;
- f >> x;
- v[pn(x)]++;
- if (y > x)
- ok = 1;
- }
- if (!ok)
- g << "DA" << endl;
- else
- g << "NU" << endl;
- x = 0;
- for(int i = 9; i >= 0; i--)
- while (v[i]) {
- x = x * 10 + i;
- v[i]--;
- }
- g << x;
- f.close();
- g.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement