Advertisement
pexea12

Lam 2

Sep 10th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. int main()
  5. {
  6.     long long t, i, a, x, idem = 0;
  7.     long long l[100], r[100];
  8.  
  9.     cin >> t;
  10.     for(i = 0; i < t; i++)
  11.     {
  12.         cin >> l[i] >> r[i];
  13.    
  14.     }
  15.  
  16.     for (i = 0; i < t; i++)
  17.     {    
  18.            for(x = l[i]; x <= r[i]; x++)
  19.            {
  20.                a = int(sqrt(x));
  21.                if(a * a == x)
  22.                   idem++;
  23.            }
  24.            cout << idem << "\n";
  25.            idem = 0;
  26.    }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement