码蹄集第23周赛(买礼物,召唤神龙,大促销,轨道探测)

买礼物

/*
 * @Author: 晚乔最美 
 * @Date: 2022-11-05 15:03:46 
 * @Last Modified by:   晚乔最美 
 * @Last Modified time: 2022-11-05 15:03:46 
 */
#include<bits/stdc++.h>
#include<bitset>
#include<unordered_map>
#define pb push_back
#define bp __builtin_popcount
#define TIME cout << "RuningTime: " << clock() << "ms\n", 0
#define ls x<<1
#define rs x<<1|1
using namespace std;
typedef  long long ll;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int MOD=9901;
const int mod = 1e9+7;
const double PI=3.14;
int lowbit(int x){return x&-x;}
ll gcd(ll x, ll y){ return y == 0 ? x : gcd(y, x%y); }
ll lcm(ll x, ll y){ return x / gcd(x, y)*y; }
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % MOD; b >>= 1; t = (t*t) % MOD; }return r; }
inline ll fpow(ll a, ll b,ll p){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % p; b >>= 1; t = (t*t) % p; }return r; }

const int maxN = 3e5 + 7;
int N;
ll a[maxN], M;

inline int read()
{
	int x = 0,f = 1;
	char ch = getchar();
	while (ch < '0' || ch>'9')
	{
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9')
	{
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return x * f;
}
int main()
{
     
    int n, k, p, q, x, y;
    x = read();y = read();
    n = read();k = read();
    q = read();p = read();

    int cvr = 21 * 60 - x * 60 - y;
    cvr = max(cvr, 0);

    
    double num1 = ceil(1.0 * n / (1.0 * p)) * q;

    int ans = n + cvr * k;

    double num2 = ceil(1.0 * ans / (1.0 * p)) * q * 0.75;

    printf("%.4f", min(num1, num2));

    //system("pause");
    return 0;
}
/*
21 00
100 1 6 5

90.0000


*/

召唤神龙

/*
 * @Author: 晚乔最美
 * @Date: 2022-11-04 13:06:46 
 * @Last Modified by:   晚乔最美
 * @Last Modified time: 2022-11-04 13:06:46 
 */
#include<bits/stdc++.h>
#include<bitset>
#include<unordered_map>
#define pb push_back
#define bp __builtin_popcount
#define TIME cout << "RuningTime: " << clock() << "ms\n", 0
#define ls x<<1
#define rs x<<1|1
using namespace std;
typedef  long long ll;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int MOD=9901;
const int mod = 1e9+7;
const double PI=3.14;
int lowbit(int x){return x&-x;}
ll gcd(ll x, ll y){ return y == 0 ? x : gcd(y, x%y); }
ll lcm(ll x, ll y){ return x / gcd(x, y)*y; }
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % MOD; b >>= 1; t = (t*t) % MOD; }return r; }
inline ll fpow(ll a, ll b,ll p){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % p; b >>= 1; t = (t*t) % p; }return r; }

const int maxN = 3e5 + 7;
int N;
ll a[maxN], M;
inline bool check(ll lim)
{
    ll sum = 0;
    for(int i=1; i<=N; i++) {
        if(a[i]<lim)
        {
            sum = sum + lim - a[i];
        }
    }
    return sum <=min(lim,M) ;
}
int main()
{
  
        scanf("%d%lld", &N, &M);
        ll sum = 0;
        for(int i=1; i<=N; i++) { scanf("%lld", &a[i]); sum += a[i]; }
        ll L = 0, R = (sum+M)/N, mid, ans = 0;

       // cout<<(check(4))<<"         "<<endl;
        while(L <= R)
        {
            mid = (L + R) >> 1LL;
            if(check(mid))
            {
                L = mid + 1;
                ans = max(ans, mid);
            }
            else R = mid - 1;
        }
        printf("%lld\n", ans);

      //  system("pause");
        return 0;
}

大促销

/*
 * @Author: 晚乔最美 
 * @Date: 2022-11-05 15:16:46 
 * @Last Modified by:   晚乔最美 
 * @Last Modified time: 2022-11-05 15:16:46 
 */
#include<bits/stdc++.h>
#include<bitset>
#include<unordered_map>
#define pb push_back
#define bp __builtin_popcount
#define TIME cout << "RuningTime: " << clock() << "ms\n", 0
#define ls x<<1
#define rs x<<1|1
using namespace std;
typedef  long long ll;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int MOD=9901;
const int mod = 1e9+7;
const double PI=3.14;
int lowbit(int x){return x&-x;}
ll gcd(ll x, ll y){ return y == 0 ? x : gcd(y, x%y); }
ll lcm(ll x, ll y){ return x / gcd(x, y)*y; }
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % MOD; b >>= 1; t = (t*t) % MOD; }return r; }
inline ll fpow(ll a, ll b,ll p){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % p; b >>= 1; t = (t*t) % p; }return r; }


inline int read()
{
	int x = 0,f = 1;
	char ch = getchar();
	while (ch < '0' || ch>'9')
	{
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9')
	{
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return x * f;
}
int main()
{
     
    int n, a, x, y;
    x = read();y = read();
    a = read();n = read();


    printf("%d\n", n % (x + y) >= x ? n / (x + y) * (a * x) + x * a : n / (x + y) * (a * x) + n % (x + y) * a);

    //system("pause");
    return 0;
}
/*
2 1 2 10

14


*/

轨道探测

/*
 * @Author: 晚乔最美 
 * @Date: 2022-11-05 17:10:46 
 * @Last Modified by:   晚乔最美 
 * @Last Modified time: 2022-11-05 17:15:46 
 */
#include<bits/stdc++.h>
#include<bitset>
#include<unordered_map>
#define pb push_back
#define bp __builtin_popcount
#define TIME cout << "RuningTime: " << clock() << "ms\n", 0
#define ls x<<1
#define rs x<<1|1
using namespace std;
typedef  long long ll;
const int inf=0x3f3f3f3f;
const int maxn=3e4+10;
const int MOD=9901;
const int mod = 1e9+7;
const double PI=3.14;
int lowbit(int x){return x&-x;}
ll gcd(ll x, ll y){ return y == 0 ? x : gcd(y, x%y); }
ll lcm(ll x, ll y){ return x / gcd(x, y)*y; }
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % MOD; b >>= 1; t = (t*t) % MOD; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

struct node{
    int x, y, r;
} a[4];
bool cmp(node p,node q)
{
    return p.r < q.r;
}

int  main()
{
    for (int i = 1; i <= 3;i++)
    cin >> a[i].x >> a[i].y >> a[i].r;

    sort(a + 1, a + 1 + 3, cmp);
    int flag = 0;
    if(a[2].x-a[2].r==a[3].x-a[3].r&&a[1].x+a[1].r==a[3].x+a[3].r&&a[2].x+a[2].r==a[1].x-a[1].r)
        flag = 1;
    if(a[1].x-a[1].r==a[3].x-a[3].r&&a[2].x+a[2].r==a[3].x+a[3].r&&a[1].x+a[1].r==a[2].x-a[2].r)
        flag = 1;
    if(a[2].y-a[2].r==a[3].y-a[3].r&&a[1].y+a[1].r==a[3].y+a[3].r&&a[2].y+a[2].r==a[1].y-a[1].r)
        flag = 1;
    if(a[1].y-a[1].r==a[3].y-a[3].r&&a[2].y+a[2].r==a[3].y+a[3].r&&a[1].y+a[1].r==a[2].y-a[2].r)
        flag = 1;
   if(flag)
       cout << "YES" << endl;
    else
        cout << "NO" << endl;
    //system("pause");

    return 0;
}
/*
3 3 2 2 3 1 4 3 1
YES

2 2 3 3 2 2 4 2 1
NO
*/
  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值