예제 #1
0
파일: 6e.c 프로젝트: kd0skh/projectEuler
int main(){
  unsigned long n = 100;
  unsigned long sol=0;
  sol=squareSum(n)-sumSquare(n);
  printf("%lu - %lu = %lu\n",squareSum(n),sumSquare(n),sol);
  return 0;
}
예제 #2
0
//AC - 0ms - there must be a loop here - since the squareSum is finite while the loop is infinite;
int isHappy1(int n)
{
    int slow=n, fast=n;
    do
    {
        slow = squareSum(slow);
        fast = squareSum(fast);
        fast = squareSum(fast);
    } while(slow != fast);
    if(slow == 1) return 1;
    else return 0;
}
예제 #3
0
int isHappy(int n)
{
    int slow=n, fast=n;
    while(slow > 1)
    {
        slow = squareSum(slow);
        if(slow == 1) return true;
        fast = squareSum(squareSum(fast));
        if(fast == 1) return true;
        if(slow == fast) return false;
    }
    return true;
}
예제 #4
0
파일: lawson.hpp 프로젝트: tjns8/face
	void createCircle() {
		float p0 = squareSum(point[0][0], point[0][1]);
		float p1 = squareSum(point[1][0], point[1][1]);
		float p2 = squareSum(point[2][0], point[2][1]);
		float xu = determinant3order(p0, point[0][1], 1, p1, point[1][1], 1, p2,
				point[2][1], 1);
		float yu = determinant3order(point[0][0], p0, 1, point[1][0], p1, 1,
				point[2][0], p2, 1);
		float d = 2
				* determinant3order(point[0][0], point[0][1], 1, point[1][0],
						point[1][1], 1, point[2][0], point[2][1], 1);
		x = xu / d;
		y = yu / d;
		r = len(x, y, point[0][0], point[0][1]);
	}
예제 #5
0
int main()
{
	std::cout << squareSum(100) - sumSquare(100) << std::endl;
}
예제 #6
0
파일: lawson.hpp 프로젝트: tjns8/face
	float len(float ax, float ay, float bx, float by) {
		float dx = bx - ax;
		float dy = by - ay;
		return sqrtf(squareSum(dx, dy));
	}