fork download
  1. /***In The Name Of God**/
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. typedef long long ll;
  5.  
  6. bool mark[11];
  7. bool flag1,flag2;
  8.  
  9. int main()
  10. {
  11. ll n;
  12. string s;
  13. cin>>n;
  14. cin>>s;
  15. for(int i=0;i<n;i++){
  16. mark[s[i]-'0']=true;
  17. }
  18. if((mark[1]||mark[2]||mark[3])&&(mark[7]||mark[9]))
  19. flag1=true;
  20. if((mark[1]||mark[4]||mark[7])&&(mark[3]||mark[6]||mark[9]))
  21. flag2=true;
  22. if((mark[1]||mark[2]||mark[3])&&mark[0]){
  23. cout<<"YES";
  24. return 0;
  25. }
  26. if(flag1&&flag2){
  27. cout<<"YES";
  28. return 0;
  29. }
  30. cout<<"NO";
  31. return 0;
  32. }
  33.  
  34.  
Runtime error #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Standard output is empty