Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,i,mod,t,v[10000],cif,cif1,l1,l2;
  6. cin>>n;
  7. for (i=0; i<n; i++)
  8. {
  9. mod=0;
  10. t=1; l1=0; l2=0;
  11. cin>>v[i];
  12.  
  13. cif1=v[i]%10;
  14. v[i]=v[i]/10; /// 753
  15. while (v[i])
  16. {
  17. cif=v[i]%10;
  18. if (cif>cif1)
  19. {
  20. l1++;
  21. if (mod==1)
  22. {
  23. t=0;
  24. break;
  25. }
  26. }
  27. else if (cif==cif1)
  28. {
  29. t=0;
  30. break;
  31. }
  32. else if (cif1>cif)
  33. { l2++;
  34. mod=1;
  35. if (l1==0)
  36. {
  37. t=0;
  38. break;
  39. }
  40.  
  41.  
  42. }
  43. cif1=cif;
  44. v[i]=v[i]/10;
  45.  
  46. }
  47. if (t==0) v[i]=0;
  48. if (l1>0 && t==1 && l2>0) v[i]=1;
  49. }
  50. for (int j=0; j<n; j++) cout<<v[j]<<'\n';
  51.  
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement