Codeforces 667A Pouring Rain 667B Coat of Anticubism

A题列个方程就解决了。

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
#define pi 3.14159265359

inline void file()
{
    freopen("D:\\go.txt", "r", stdin);
    freopen("D:\\leave.txt", "w", stdout);
}

int main()
{
    //file();
    //ios::sync_with_stdio(false);
    double d, h, v, e;
    scanf("%lf%lf%lf%lf", &d, &h, &v, &e);
    if ((pi * (d / 2) * (d / 2) * e >= v))
        printf("NO\n");
    else
    {
        double tmp1 = pi * (d / 2) * (d / 2) * h;
        double tmp = pi * (d / 2) * (d / 2) * e;
        printf("YES\n%.12f\n", tmp1 / (v - tmp));
    }
    return 0;
}

B题就是两边之和大于第三边,一下就搞定了

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;
typedef __int64 ll;
#define pi 3.14159265359
const int MAX = 1e5 + 5;
typedef long long ll;
ll arr[MAX];

inline void file()
{
    freopen("D:\\go.txt", "r", stdin);
    freopen("D:\\leave.txt", "w", stdout);
}

int main()
{
    //file();
    //ios::sync_with_stdio(false);
    int n;
    scanf("%d", &n);
    ll res = 0;
    for (int i = 0; i < n; ++i)
    {
         scanf("%I64d", &arr[i]);
         res += arr[i];
    }
    ll a = res / 3;
    sort(arr , arr + n);
    ll t1 = 0;
    for (int i = n - 1; i >= 0; --i)
    {
        t1 += arr[i];
        if (t1 >= a)
            break;
    }
    ll tmp = res - t1;
    printf("%I64d\n", abs(tmp - t1) + 1);
    return 0;
}

A,B都是很简单的应该,,用文件交题A和B的时候,代码复制错了,WA了几次。。。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值