Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f("bosumflat.in");
- ofstream g("bosumflat.out");
- int grad[5005],par[5005],impar[5005],n,x,i,nr,p1,p2,j;
- int main()
- {
- f>>n;
- for(i=1;i<=n;i++)
- {
- f>>x;
- p1=1;
- p2=1;
- nr=8;
- while(x!=0)
- {
- if(nr%2==0)
- {
- par[i]=p1*(x%10)+par[i];
- p1=p1*10;
- }
- else
- {
- impar[i]=p2*(x%10)+impar[i];
- p2=p2*10;
- }
- nr--;
- x=x/10;
- }
- }
- for(i=1;i<=n;i++)
- {
- for(j=i+1;j<=n;j++)
- {
- if(impar[i]<par[j] && par[i]>impar[j])
- {
- grad[i]++;
- grad[j]++;
- }
- }
- }
- for(i=1;i<=n;i++)
- g<<grad[i]<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement