Advertisement
ShafiulAzim

codeforces 1167A

Feb 22nd, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,t,i,ans;
  6. cin>>t;
  7. while(t--)
  8. {
  9. ans=0;
  10. cin>>n;
  11. string str;
  12. cin>>str;
  13. if(n>=11)
  14. {
  15. if(n==11 && str[0]=='8')
  16. cout<<"YES"<<endl;
  17. else
  18. {
  19. for(i=0; i<n; i++)
  20. {
  21. if(str[i]=='8')
  22. {
  23. ans=n-i;
  24. break;
  25. }
  26. }
  27. if(ans>=11)
  28. cout<<"YES"<<endl;
  29. else
  30. cout<<"NO"<<endl;
  31.  
  32. }
  33. }
  34. else
  35. cout<<"NO"<<endl;
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement