排位2

B.steel heart(主要是心之刚效果和冷却效果30秒的特判)

#include<bits/stdc++.h>
using namespace std;
struct gang
{
    int hh;
    int mm;
    int t;
    int e;
};
struct gang g[10000];
int main()
{
    int h1,h2,m;
    cin>>h1>>h2>>m;
    int t1[10]={0};
    for(int i=0;i<m;i++)
    {
        scanf("%2d:%2d %d",&g[i].hh,&g[i].mm,&g[i].t);
        if(g[i].t==3)scanf("%d",&g[i].e);
    }
    int b=0;
    for(int i=0;i<m;i++)
    {
        if(g[i].t==2)h1+=h2;
        if(g[i].t==1)h1+=800,b=1;
        if(g[i].t==3)
        {
            if(b==1&&t1[g[i].e]==0||b==1&&g[i].hh*60+g[i].mm-t1[g[i].e]>=30)
            {
                h1=h1+(125+0.06*h1)*0.1;
                t1[g[i].e]=g[i].hh*60+g[i].mm;
            }
        }
    }
    cout<<h1<<endl;
    return 0;
}

F.survivor(先将伤害都加上,再排序需要治疗的次数,求前缀和最后比较)

#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[1000000],b[1000000],c[1000000],f[1000000],s[10000000];
void solve()
{
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        cin>>b[i];
    for(int i=1;i<=n;i++)
        cin>>c[i];
    for(int i=1;i<=n;i++)
    {
        f[i]=((b[i]*m)-a[i])/c[i]+1;
        f[i]=f[i]>0?f[i]:0;
    }
    sort(f+1,f+n+1);
    for(int i=1;i<=n;i++)
    {
        s[i]=s[i-1]+f[i];
    }
    for(int i=1;i<=n;i++)
    {
        if(s[i]>k)
        {
            cout<<i-1<<endl;
            return;
        }
    }
    cout<<n<<endl;
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL) , cout.tie(NULL);
    int T = 1;
//    cin >> T ;
    while(T--) solve();
    return 0;
}

J.simple game(很多方式都会超时,只有计算奇数个数判断是奇数个还是偶数个不t)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int sum=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        sum+=(x&1);
    }
    if(sum&1)printf("Alice\n");
    else printf("Bob\n");
    return 0;
}

  

posted @ 2024-02-03 13:59  伊芙加登  阅读(15)  评论(0)    收藏  举报