“Sometimes it is the people no one can imagine anything of who do the things no one can imagine.” ― Sir Alan Turing


ADS

ADS

Sunday, April 9, 2017

UVa 11461 Square Numbers Solution in C / C++



Source Code

#include <iostream>
#include <cmath>

using namespace std;

int main()

{

  int bot, top;

  cin >> bot >> top;

  while (bot)

  {

    int count(0);

    int num = sqrt(bot);

    if (num * num < bot)

      ++num;

    for (; num * num <= top; ++num, ++count);

    cout << count << '\n';

    cin >> bot >> top;

  }

}

No comments:

Post a Comment