Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int prime(ll n){
- if(n==1) return 0;
- ll raiz = sqrt(n)+1;
- for(ll i = 2; i<raiz; i++){
- if(n%i==0){
- return 0;
- break;
- }
- }
- return 1;
- }
- int main() {
- int t;
- ll a, b, s = 0;
- cin>>t;
- double aux;
- ll aux2=0;
- while(t>0){
- cin>>a>>b;
- s = 0;
- for(int i= a;i<=b;i++){
- aux = sqrt(i);
- if(pow(aux, 2)==i){
- aux2 = (int)aux;
- if(prime(aux2)){
- s++;
- }
- }
- }
- cout<<s<<"\n";
- t--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment