Saturday, April 25, 2020

1097A. Gennady and a Card Game solution


  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. string table;
  6. string hand,s="";
  7. int i;bool yes=false;
  8. cin>>table;
  9. for(int j=0;j<5;j++)
  10. {
  11. cin>>hand;
  12. if(hand[0]==table[0] or hand[1]==table[1] or hand[1]==table[0] or hand[0]==table[1])
  13. {yes=1;
  14.  
  15. break;}
  16.  
  17. }
  18. if(yes==1)cout<<"YES";
  19. else cout<<"NO";
  20. return 0;
  21. }

No comments:

Post a Comment

Aptitude test assistant programmer 2018

 #include <stdio.h> #include <stdlib.h> int main() { char str[100]; int i; int space=0;     printf("Enter a string\n")...