Nathan Coulas

CCC '09 S1 - Cool Numbers

ccc09s1 CPP17 17 Feb, 2020 0.151s 5 points

Source Code

#include <iostream>
#include <math.h>
#include <bits/stdc++.h>

using namespace std;

template<class C>constexpr int sz(const C&c){return int(c.size());}

using ll=long long;constexpr const char nl='\n',sp=' ';


  int main(){
      ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

      int a, b, c = 0, cbstart, cbend, sqstart, sqend;
      cin >> a >> b;
      
      sqstart = sqrt(a);
      sqend = sqrt(b);  
      cbstart = cbrt(a);
      cbend = cbrt(b);
      
      for(int i = sqstart; i <= sqend; i++){
		  for(int f = cbstart; f <= cbend; f++){
			  if(pow(i, 2) == pow(f, 3)){
				  c++;
			  }
		  }
	
	  }

      cout << c << endl;
      return 0;
  }