Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int a[101]={},poz[101]={};
- ifstream f("subnumar.in");
- ofstream g("subnumar.out");
- void prelucrare(int x)
- {
- int nr;
- while(x>9)
- {
- //nr=((x/10)%10)*10+x%10;
- nr=x%100;
- a[nr]++;
- x=x/10;
- }
- }
- int main()
- {
- int x;
- while(f>>x)
- {
- prelucrare(x);
- }
- for(int i=10;i<=99;i++)
- {
- poz[i]=i;
- }
- int ok=1;
- do
- {
- ok=1;
- for(int i=11;i<=99;i++)
- {
- if(a[i-1]>a[i])
- {
- swap(a[i-1],a[i]);
- swap(poz[i-1],poz[i]);
- ok=0;
- }
- }
- }
- while(ok==0);
- for(int i=99;i>=10;i--)
- {
- //cout<<poz[i]<<" ";
- if(a[i]==a[99])
- g<<poz[i]<<" ";
- // else
- // break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement