Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int v[1000];
- int main(){
- ifstream f1("atestat.in");
- ofstream f2("atestat.out");
- int n,x,y,ver=0,i=0,p,ok=0,a,aux,j;
- f1>>n;
- while(f1>>x){
- y=x;
- i++;
- while(y >= 10)
- y=y/10;
- if(y == 0)
- i--;
- if(y != 0)
- v[i]=y;
- if(ver == 0){
- ver=1;
- p=x;
- }
- else
- if(ok == 0)
- if(p > x)
- ok=1;
- p=x;
- }
- if(ok == 0)
- f2<<"DA";
- else
- f2<<"NU";
- f2<<endl;
- for(a=1;a<=i-1;a++)
- for(j=a+1;j<=i;j++)
- if(v[a] < v[j]){
- aux=v[a];
- v[a]=v[j];
- v[j]=aux;
- }
- for(j=1;j<=i;j++)
- f2<<v[j];
- }
Add Comment
Please, Sign In to add comment