首页 > ACM题库 > HDU-杭电 > HDU 2876-Ellipse, again and again-数学相关-[解题报告]HOJ
2014
02-17

HDU 2876-Ellipse, again and again-数学相关-[解题报告]HOJ

Ellipse, again and again

问题描述 :

There is an ellipse in the plane, its formula is . We denote the focuses by F1 and F2. There is a point P in the plane. Draw a segment to associate the origin and P, which intersect the ellipse at point Q. Then draw a tangent of the ellipse which passes Q. Denote the distance from the center of the ellipse to the tangent by d. Calculate the value of .

输入:

The first line contains a positive integer n that indicates number of test cases.
And each test case contains a line with four integers. The value of parameters of the ellipse a, b(0<|a|,|b|<=100),and the coordinates x, y of P(|x|<=100,|y|<=100) are given successively.

输出:

The first line contains a positive integer n that indicates number of test cases.
And each test case contains a line with four integers. The value of parameters of the ellipse a, b(0<|a|,|b|<=100),and the coordinates x, y of P(|x|<=100,|y|<=100) are given successively.

样例输入:

1
1 1 1 1

样例输出:

1

点击打开链接

题意:

给你椭圆a,b和一点坐标x0y0,四个都是整数,求d*d*qf1*qf2

显然ans=a*a*b*b;;

#include"stdio.h"
void main()
{
	int a,b,x0,y0;
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d%d%d",&a,&b,&x0,&y0);
		if(x0*x0/(a*a)+y0*y0/(b*b)<1)printf("In ellipse\n");
		else printf("%d\n",a*a*b*b);
	}
}

解题参考:http://blog.csdn.net/yangyafeiac/article/details/9621085


  1. #include <stdio.h>
    int main(void)
    {
    int arr[] = {10,20,30,40,50,60};
    int *p=arr;
    printf("%d,%d,",*p++,*++p);
    printf("%d,%d,%d",*p,*p++,*++p);
    return 0;
    }

    为什么是 20,20,50,40,50. 我觉得的应该是 20,20,40,40,50 . 谁能解释下?

  2. #!/usr/bin/env python
    def cou(n):
    arr =
    i = 1
    while(i<n):
    arr.append(arr[i-1]+selfcount(i))
    i+=1
    return arr[n-1]

    def selfcount(n):
    count = 0
    while(n):
    if n%10 == 1:
    count += 1
    n /= 10
    return count