浙江农林大学2021年新生杯程序设计竞赛(同步赛)

未来是你们的

#include <iostream>
using namespace std;

int main()
{
printf(R"(14    ChenMingjian
Bronze
Peking University
Microsoft|Meituan

15    YuKai
Silver
None
Huanle Entertainment|Bytedance

16    YingShangwei
Silver
Zhejiang University
Huanle Entertainment|One Smile

17    HuangLei
Gold
None
Alibaba

18    ZhangYehao
Silver
None
Bytedance

19    WangZichao
Gold
None
Alibaba

20    YangChengyi
Waiting
None
None)");
}

学习使我快乐

#include <iostream>
#include <map>
using namespace std;

map<string, string> ma;

int main()
{
    ma["gcd"] = "Greatest common factor";
    ma["Fast exponentiation algorithm"] = "Fast exponentiation";
    ma["Disjoint Set Union"] = "Element grouping";
    ma["Dijkstra"] = "Shortest path";
    ma["kmp"] = "Pattern string matching";
    ma["manacher"] = "Palindrome";
    ma["prim"] = "Minimum spanning tree";
    ma["Hungarian algorithm"] = "Bipartite graph matching";
    ma["segment tree"] = "Interval maintenance";
    ma["Nim"] = "game";
    ma["Polynomial"] = "Dogs don't learn";

    int _; cin >> _; cin.get();
    while (_ -- )
    {
        string s; getline(cin, s);
        cout << ma[s] << endl;
    }
}

埃辛诺斯战刃

#include <iostream>
using namespace std;

int main()
{
    int n, m; scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i ++ )
    {
        for (int j = 1; j <= i; j ++ )
            cout << '*';
        cout << endl;
    }
    for (int i = 1; i <= m; i ++ )
    {
        for (int j = 1; j <= n - 1; j ++ )
            cout << ' ';
        cout << '*' << endl;
    }
    for (int i = 1; i <= n; i ++ )
    {
        for (int j = 1; i + j <= n + 1; j ++ )
            cout << '*';
        cout << endl;
    }
}

神之罚

#include <iostream>
using namespace std;

const int N = 3010;

typedef long long ll;

ll row[N], col[N];
ll w[N][N];

int main()
{
    int n, m; scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i ++ )
        for (int j = 0; j < m; j ++ )
        {
            scanf("%lld", &w[i][j]);
            row[i] += w[i][j];
            col[j] += w[i][j];
        }
    
    ll mx = 0;
    for (int i = 0; i < n; i ++ )
        for (int j = 0; j < m; j ++ )
            mx = max(mx, row[i] + col[j] - w[i][j]);
    cout << mx;
}

隐藏的南通

#include <iostream>
#include <algorithm>
using namespace std;

const int N = 1e5 + 10;

typedef pair<int, int> PII;

PII a[N];

int main()
{
    int n; scanf("%d", &n);
    for (int i = 0; i < n && scanf("%d", &a[i].first); i ++ );
    for (int i = 0; i < n && scanf("%d", &a[i].second); i ++ )
    {
        if (a[i].first < a[i].second)
            swap(a[i].first, a[i].second);
    }
    
    sort(a, a + n, greater<PII>());
    
    int ans = 1e9;
    int mx = a[0].second, mi = a[n - 1].first;
    for (int i = 0; i < n; i ++ )
    {
        ans = min(ans, max(mx, a[i].first) - mi);
        mx = max(mx, a[i].second);
        mi = min(mi, a[i].second);
    }
    
    cout << ans;
}

一决01(again)

#include <iostream>
using namespace std;

const int N = 1010;

bool st[N];

int main()
{
    
    for (int i = 1; i <= 1000; i ++ )
    {
        for (int j : {1, 2, 9, 20, 24})
        {
            if (i >= j && st[i - j] == false)
                st[i] = true;
        }
    }
    
    int _; scanf("%d", &_);
    while (_ -- )
    {
        int x; scanf("%d", &x);
        if (x > 1000) x = x % 500 + 500;
        if (st[x]) puts("GuaGua shi 1!CeCe shi 0!");
        else puts("CeCe shi 1!GuaGua shi 0!");
    }
}

策策学长的排位日志

#include <iostream>
using namespace std;

int main()
{
    int n, p, q; cin >> n >> p >> q;
    int cnt = 0;
    
    for (int _ = 0; _ < n; _ ++ )
    {
        int kk, dd, aa; cin >> kk >> dd >> aa;
        int k, d, a;
        int cntk = 0, cntd = 0;
        bool ok = true;
        double kda = 0;
        if (dd != 0) kda = (kk + aa) * 1.0 / dd;
        cntk += kk, cntd += dd;
        
        for (int i = 0; i < 4; i ++ )
        {
            cin >> k >> d >> a;
            cntk += k, cntd += d;
            if ((k + a) * 1.0 / d > kda) ok = false;
        }
        if (dd == 0) ok = true;
        
        if (cntk >= cntd)
        {
            if (ok) cnt += 2 * p;
            else cnt += p;
        }
        else
        {
            if (!ok)
            {
                if (cnt < 100) cnt -= q;
                cnt = max(cnt, 0);
            }
        }
        
//        cout << cntk << ' ' << cntd << endl;
    }
    
    if (cnt >= 100) cout << "YES";
    else cout << "NO";
}

zby 大小姐想让 zyx 学姐告白

#include <iostream>
using namespace std;

int main()
{
    int n; scanf("%d", &n);

    int cnt5 = 0, cnt2 = 0, cnt0 = 0;
    for (int i = 0, x; i < n && scanf("%d", &x); i ++ )
    {
        if (x == 5) cnt5 ++ ;
        else if (x == 2) cnt2 ++ ;
        else if (x == 0) cnt0 ++ ;
    }
    cout << min(cnt5, min(cnt2, cnt0));
}

zby 大小姐想让 zyx 学姐告白之大反派 ycy

#include <iostream>
using namespace std;

int main()
{
    int n; scanf("%d", &n);
    int cnt5 = 0, cnt2 = 0, res = 0;
    
    for (int i = 0, x; i < n && scanf("%d", &x); i ++ )
    {
        if (x == 5) cnt5 ++ ;
        else if (x == 2 && cnt5) cnt5 -- , cnt2 ++ ;
        else if (x == 0 && cnt2) cnt2 -- , res ++ ;
    }
    cout << res;
}

至高无上的教皇

#include <iostream>
using namespace std;

const int N = 3e3 + 10;

int h[N], cnt[N];

int main()
{
    int n; scanf("%d", &n);
    for (int i = 0; i < n && scanf("%d", &h[i]); i ++ );
    
    for (int i = 0; i < n; i ++ )
    {
        double mx;
        for (int j = i + 1; j < n; j ++ )
        {
            double t = (h[j] - h[i]) * 1.0 / (j - i);
            if (j == i + 1) cnt[i] ++ , cnt[j] ++ , mx = t;
            else if (t > mx)
            {
                mx = t;
                cnt[i] ++ , cnt[j] ++ ;
            }
        }
    }
    
    for (int i = 0; i < n; i ++ ) printf("%d ", cnt[i]);
}

教皇的达拉崩巴

#include <iostream>
#include <cmath>
using namespace std;

typedef long long ll;

int main()
{
    int _; scanf("%d", &_);
    while (_ -- )
    {
        ll x, y; scanf("%lld%lld", &x, &y);
        ll res = sqrt(x * y);
        if (res * res == x * y) puts("zhl he zwc tie tie");
        else puts("zyx he zby tie tie");
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值