fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t,n; cin >> t;
  6. while(t--){
  7. cin >> n;
  8. if(n < 3) cout << "NO\n";
  9. else if(n % 3 == 0 || n % 7 == 0) cout << "YES\n";
  10. else{
  11. bool yum = false;
  12. while(n>9){
  13. n-=7;
  14. if(n%3 == 0){
  15. yum = true;
  16. break;
  17. }
  18. }
  19. yum ? cout << "YES\n" : cout << "NO\n";
  20. }
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5280KB
stdin
2
6
5


stdout
YES
NO