Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream fin("catsfood.in");
- ofstream fout("catsfood.out");
- int a,b,c,n,x;
- int main()
- {
- int x1,x2,x3,x4,x5,x6,ok1,u,v,w,nr,ok2;
- fin>>a>>b>>c>>n;
- x1=a*100+b*10+c;
- x2=a*100+c*10+b;
- x3=b*100+a*10+c;
- x4=b*100+c*10+a;
- x5=c*100+a*10+b;
- x6=c*100+b*10+a;
- nr=0;
- ok2=0;
- while(n--)
- {
- fin>>x;
- u=x/100;
- w=x%10;
- v=x/10%10;
- ///punctul 1
- ok1=0;
- if(u==a||u==b||u==c)
- ok1=1;
- if(v==a||v==b||v==c)
- ok1=1;
- if(w==a||w==b||w==c)
- ok1=1;
- if(ok1==1)
- nr++;
- ///punctul 2
- if(x==x1||x==x2||x==x3||x==x4||x==x5||x==x6)
- ok2=1;
- }
- fout<<nr<<endl;
- if(ok2==1)
- fout<<"DA";
- else
- fout<<"NU";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement