Saleh127

codeforces 937B.cpp

May 27th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int p,y,a=0,b,c,d,f,e,i,j,k,l;
  6. cin>>p>>y;
  7. for(i=y;i>p;i--)
  8. {
  9. a=0;
  10. for(j=2;j*j<=i && j<=p;j++)
  11. {
  12. if(i%j==0)
  13. {
  14. a=1;
  15. break;
  16. }
  17. }
  18. if(a==0)
  19. {
  20. cout<<i<<endl;
  21. return 0;
  22. }
  23. }
  24. cout<<-1<<endl;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment