Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct E
- {
- int val, nrd;
- }a[1001];
- int divizor(E x)
- {
- int nr = 0, d;
- for(d = 1; d * d < n; d+=2)
- if(n % d == 0) nr+=2;
- if(d * d == n) nr++;
- return nr;
- }
- ifstream fin("sort_div.in");
- ofstream fout("sort_div.out");
- int main()
- {
- fin >> n;
- for(i = 1; i <= n; i++)
- {
- fin >> a[i].val;
- a[i].nrd = divizor(a[i].val);
- }
- for(i = 1; i <= n; i++)
- for( j = i + 1; j <= n; j++)
- if(a[i].nrd < a[j].nrd
- || a[i].nrd == a[j].nrd
- && a[i].val > a[j].val)swap(a[i], a[j]);
- for(i = 1; i <= n; i++)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement