Advertisement
a53

Catsfood

a53
Feb 23rd, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. ifstream fin("catsfood.in");
  4. ofstream fout("catsfood.out");
  5. int a,b,c,n,x;
  6. int main()
  7. {
  8. int x1,x2,x3,x4,x5,x6,ok1,u,v,w,nr,ok2;
  9. fin>>a>>b>>c>>n;
  10. x1=a*100+b*10+c;
  11. x2=a*100+c*10+b;
  12. x3=b*100+a*10+c;
  13. x4=b*100+c*10+a;
  14. x5=c*100+a*10+b;
  15. x6=c*100+b*10+a;
  16. nr=0;
  17. ok2=0;
  18. while(n--)
  19. {
  20. fin>>x;
  21. u=x/100;
  22. w=x%10;
  23. v=x/10%10;
  24. ///punctul 1
  25. ok1=0;
  26. if(u==a||u==b||u==c)
  27. ok1=1;
  28. if(v==a||v==b||v==c)
  29. ok1=1;
  30. if(w==a||w==b||w==c)
  31. ok1=1;
  32. if(ok1==1)
  33. nr++;
  34. ///punctul 2
  35. if(x==x1||x==x2||x==x3||x==x4||x==x5||x==x6)
  36. ok2=1;
  37. }
  38. fout<<nr<<endl;
  39. if(ok2==1)
  40. fout<<"DA";
  41. else
  42. fout<<"NU";
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement