10234_Pia'sParty

2022-5-16 18:16| 发布者: Hocassian| 查看: 67| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504683554099-Problem List-采集的数据-后羿采集器.html

Pro.ID

10234

Title

Pia's Party

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10234

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    Pia wants to set up the audio system for her birthday party. The party will take place on a circular area because Pia believes that a circle is the most beautiful 2-dimensional shape. Pia has four loudspeakers that she can place on certain points of the circle's circumference. From her extensive party experience she knows that people will only dance in the area inside the four loudspeakers. As she wants a big a dance floor as possible she wants to maximize the quadrilateral defined by the four loudspeakers. Can you help Pia?
    Problem
    You are given a circle of diameter d, with n points equally spaced around the circumference. The points are numbered in order around the circle 0, 1, 2, . . . , n - 1. Of those n points, c of them are suitable for placing the loudspeakers on. These points are given by the generator function (g * k) mod n, for k in {0, 1, 2, . . . , c-1}. Given integers d, n, c, and g you are to compute the largest area that can be formed by placing four loudspeakers on suitable points.

    输入

    The first line contains the number of scenarios.
    Every scenario consists of a single line containing four integers separated by a space. The meaning of these numbers are in order:

    • The diameter d of the circle (1 ≤ d 1000).

    • The number n of points on the circle (4 n 109 ).

    • The number c of suitable points for the loudspeakers (4 c 1000 and c n).

    • The number g for the generator function (1 g n) which will be relatively prime to n (e.g. they do not have a common divisor greater than 1).

    输出

    Description

    Pia wants to set up the audio system for her birthday party. The party will take place on a circular area because Pia believes that a circle is the most beautiful 2-dimensional shape. Pia has four loudspeakers that she can place on certain points of the circle's circumference. From her extensive party experience she knows that people will only dance in the area inside the four loudspeakers. As she wants a big a dance floor as possible she wants to maximize the quadrilateral defined by the four loudspeakers. Can you help Pia?
    Problem
    You are given a circle of diameter d, with n points equally spaced around the circumference. The points are numbered in order around the circle 0, 1, 2, . . . , n - 1. Of those n points, c of them are suitable for placing the loudspeakers on. These points are given by the generator function (g * k) mod n, for k in {0, 1, 2, . . . , c-1}. Given integers d, n, c, and g you are to compute the largest area that can be formed by placing four loudspeakers on suitable points.

    Input

    The first line contains the number of scenarios.
    Every scenario consists of a single line containing four integers separated by a space. The meaning of these numbers are in order:

    • The diameter d of the circle (1 ≤ d 1000).

    • The number n of points on the circle (4 n 109 ).

    • The number c of suitable points for the loudspeakers (4 c 1000 and c n).

    • The number g for the generator function (1 g n) which will be relatively prime to n (e.g. they do not have a common divisor greater than 1).

    Output

    The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1.
    Then print a single line with the maximum area Pia can achieve for her dance floor. Print this area rounded to six decimal places. Every scenario is finished by a blank line.

    Sample Input
    4
    10 13 4 3
    20 31 6 5
    1000 80000 50 3
    100 1200 20 139
    Sample Output
    Scenario #1:
    48.914286
    
    Scenario #2:
    179.100273
    
    Scenario #3:
    0.028490
    
    Scenario #4:
    4965.195940
    Source

    样例输入

    4
    10 13 4 3
    20 31 6 5
    1000 80000 50 3
    100 1200 20 139

    样例输出

    Scenario #1:
    48.914286
    
    Scenario #2:
    179.100273
    
    Scenario #3:
    0.028490
    
    Scenario #4:
    4965.195940

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部