spoj BCPRIME


SUBMITTED BY: Guest

DATE: Feb. 16, 2014, 4:35 a.m.

FORMAT: C++

SIZE: 604 Bytes

HITS: 851

  1. //Haha TTpro
  2. //BCPRIME
  3. //http://www.spoj.com/PTIT/problems/BCPRIME/
  4. #include <iostream>
  5. using namespace std;
  6. bool HahaTTproUltimate(int kaboom);
  7. int main()
  8. {
  9. long int hahattpro;
  10. cin >>hahattpro;
  11. if (HahaTTproUltimate(hahattpro)) cout <<"YES"; else cout<<"NO";
  12. }
  13. bool HahaTTproUltimate(int kaboom)
  14. {
  15. int fuck;
  16. if (kaboom == 1) return false;
  17. for (fuck = 2; fuck< kaboom; fuck ++ )
  18. {
  19. if ((kaboom % fuck) == 0) return false;
  20. }
  21. return true;
  22. }

comments powered by Disqus