LightOJ 1216 圆锥体积

本文探讨了一种特殊的编程竞赛问题——寻找前一个问题的相反任务。具体而言,已知两个计算机中存储的问题总数且无重复问题,每个计算机最多存储10个问题,需要找出每个计算机中的问题数量。文章提供了样例输入输出,并附带了一个使用计算几何算法解决不同问题的代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1001 - Opposite Task
PDF (English) Statistics Forum
Time Limit: 0.5 second(s) Memory Limit: 32 MB
This problem gives you a flavor the concept of special judge. That means the judge is smart enough to verify your code even though it may print different results. In this problem you are asked to find the opposite task of the previous problem.

To be specific, I have two computers where I stored my problems. Now I know the total number of problems is n. And there are no duplicate problems and there can be at most 10 problems in each computer. You have to find the number of problems in each of the computers.

Since there can be multiple solutions. Any valid solution will do.

Input
Input starts with an integer T (≤ 25), denoting the number of test cases.

Each case starts with a line containing an integer n (0 ≤ n ≤ 20) denoting the total number of problems.

Output
For each case, print the number of problems stored in each computer in a single line. A single space should separate the non-negative integers.

Sample Input
Output for Sample Input
3
10
7
7
0 10
0 7
1 6


PROBLEM SETTER: JANE ALAM JAN

 

<span style="color:#6600cc;">/*************************************************

     author     :     Grant Yuan
     time       :     2014.8.7
     algorithm  :     计算几何
     source     :     Light Oj 1216
     
**************************************************/

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#define pi acos(-1)

using namespace std;
int r1,r2,h,t,p;
double h1,ans,r3;

int main()
{
    scanf("%d",&t);
    cout<<pi<<endl;
    for(int i=1;i<=t;i++)
    {
        scanf("%d%d%d%d",&r1,&r2,&h,&p);
        h1=(r2*h*1.0)/(r1-r2);
        r3=(p+h1)*r1*1.0/(h1+h);
        ans=(h1+p)*pi*r3*r3/3-h1*pi*r2*r2/3;
        printf("Case %d: %.7lf\n",i,ans);
    }
    return 0;
}
</span>


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值