传送门

A 雨

签到题,可惜我还多打了一个空格,不好说

/*
    Author : north_h
    File : B.cpp
    Time : 2023/7/26/14:58
                    _   _         _     
   _ __   ___  _ __| |_| |__     | |__  
  | '_ \ / _ \| '__| __| '_ \    | '_ \ 
  | | | | (_) | |  | |_| | | |   | | | |
  |_| |_|\___/|_|   \__|_| |_|___|_| |_|
                            |_____|     
*/
#pragma GCC optimize(3)

#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr), cout.tie(nullptr);
#define met_0(a) memset(a,0,sizeof a)
#define met_1(a) memset(a,-1,sizeof a)
#define met_x(a) memset(a,0x3f,sizeof a)
#define mpy(a, b) memcopy(a,sizeof b,b)
#define ll long long
#define ld long double
#define ull unsigned long long
#define fi first
#define se second
#define PII pair<int,int>
#define PDD pair<double,double>
#define PCI pair<char,int>
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.begin(),a.end()
#define int128 __int128
#define endl '\n'
const int N = 10010;
const int M = 110;
const int MOD = 998244353;
const int EPS = 1e-8;
const int INF = 0x3f3f3f3f;

using namespace std;

void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >>d;
    int x;
    cin >> x;
    if (a < x)cout << x - a << ' ';
    else cout << 0 << ' ';
    if (b < x)cout << x - b << ' ';
    else cout << 0 << ' ';
    if (c < x)cout << x - c << ' ';
    else cout << 0 << ' ';
    if (d < x)cout << x - d << ' ';
    else cout << 0 << ' ';
}

int main() {
    IOS;
    int h_h = 1;
    //cin >> h_h;
    while (h_h--)solve();
    return 0;
}

B 吻

推公式,可能会报longlong,用int128来算,最后输出的时候转成longlong即可

/*
    Author : north_h
    File : A.cpp
    Time : 2023/7/26/14:58
                    _   _         _     
   _ __   ___  _ __| |_| |__     | |__  
  | '_ \ / _ \| '__| __| '_ \    | '_ \ 
  | | | | (_) | |  | |_| | | |   | | | |
  |_| |_|\___/|_|   \__|_| |_|___|_| |_|
                            |_____|     
*/
#pragma GCC optimize(3)

#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr), cout.tie(nullptr);
#define met_0(a) memset(a,0,sizeof a)
#define met_1(a) memset(a,-1,sizeof a)
#define met_x(a) memset(a,0x3f,sizeof a)
#define mpy(a, b) memcopy(a,sizeof b,b)
#define int long long
#define ld long double
#define ull unsigned long long
#define fi first
#define se second
#define PII pair<int,int>
#define PDD pair<double,double>
#define PCI pair<char,int>
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.begin(),a.end()
#define int128 __int128
#define endl '\n'
const int N = 10010;
const int M = 110;
const int MOD = 998244353;
const int EPS = 1e-8;
const int INF = 0x3f3f3f3f;

using namespace std;


void solve() {
    int n;
    cin >> n;
    int128 res = (int128) (1 + 2 * n - 1) * n / 2 % MOD;
    cout << (int) res << endl;
}

int32_t main() {
    IOS;
    int h_h = 1;
    //cin >> h_h;
    while (h_h--)solve();
    return 0;
}

C 失

按照题目意思模拟一下即可

/*
    Author : north_h
    File : C.cpp
    Time : 2023/7/26/14:58
                    _   _         _     
   _ __   ___  _ __| |_| |__     | |__  
  | '_ \ / _ \| '__| __| '_ \    | '_ \ 
  | | | | (_) | |  | |_| | | |   | | | |
  |_| |_|\___/|_|   \__|_| |_|___|_| |_|
                            |_____|     
*/
#pragma GCC optimize(3)

#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr), cout.tie(nullptr);
#define met_0(a) memset(a,0,sizeof a)
#define met_1(a) memset(a,-1,sizeof a)
#define met_x(a) memset(a,0x3f,sizeof a)
#define mpy(a, b) memcopy(a,sizeof b,b)
#define ll long long
#define ld long double
#define ull unsigned long long
#define fi first
#define se second
#define PII pair<int,int>
#define PDD pair<double,double>
#define PCI pair<char,int>
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.begin(),a.end()
#define int128 __int128
#define endl '\n'
const int N = 10010;
const int M = 110;
const int MOD = 998244353;
const int EPS = 1e-8;
const int INF = 0x3f3f3f3f;

using namespace std;

bool cmp(pair<double,string> c,pair<double,string>d) {
    if (c.fi != d.fi)return c.fi > d.fi;
    else return c.se < d.se;
}

void solve() {
    string s;
    int n;
    cin >> s >> n;
    vector<string> a(n);
    vector<pair<double, string>> ans;
    for (auto &i: a)cin >> i;
    for (auto i: a) {
        int cnt = 0;
        if (i.size() != s.size()) {
            ans.push_back({0, i});
            continue;
        }
        for (int j = 0; j < s.size(); j++) {
            if (s[j] == i[j])cnt++;
        }
        int sum = s.size();
        ans.push_back({cnt * 1.0 / sum, i});
    }
    sort(ALL(ans), cmp);
    double now = ans[0].fi;
    cout << ans[0].se << endl;
    for (int i = 1; i < ans.size(); i++) {
        if (ans[0].fi == now)cout << ans[i].se << endl;
    }
}

int main() {
    IOS;
    int h_h = 1;
    //cin >> h_h;
    while (h_h--)solve();
    return 0;
}

D 吹

最简单的动态规划,没写出来。菜是原罪,这里只有两个状态,要么前面变成1,要么不变,但是每个位置都要讨论变和不变的情况,每种情况都由前面变与不变的情况推出来

/*
    Author : north_h
    File : D.cpp
    Time : 2023/7/26/14:58
                    _   _         _     
   _ __   ___  _ __| |_| |__     | |__  
  | '_ \ / _ \| '__| __| '_ \    | '_ \ 
  | | | | (_) | |  | |_| | | |   | | | |
  |_| |_|\___/|_|   \__|_| |_|___|_| |_|
                            |_____|     
*/
#pragma GCC optimize(3)

#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr), cout.tie(nullptr);
#define met_0(a) memset(a,0,sizeof a)
#define met_1(a) memset(a,-1,sizeof a)
#define met_x(a) memset(a,0x3f,sizeof a)
#define mpy(a, b) memcopy(a,sizeof b,b)
#define ll long long
#define ld long double
#define ull unsigned long long
#define fi first
#define se second
#define PII pair<int,int>
#define PDD pair<double,double>
#define PCI pair<char,int>
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.begin(),a.end()
#define int128 __int128
#define endl '\n'
const int N = 100010;
const int M = 110;
const int MOD = 998244353;
const int EPS = 1e-8;
const int INF = 0x3f3f3f3f;

using namespace std;

int dp[N][2];

void solve() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++)cin >> a[i];
    for (int i = 2; i <= n; i++) {
        dp[i][0] = max(dp[i - 1][0] + abs(a[i] - a[i - 1]), dp[i - 1][1] + abs(a[i] - 1));
        dp[i][1] = max(dp[i - 1][0] + a[i - 1] - 1, dp[i - 1][1]);
    }
    cout << max(dp[n][1], dp[n][0]) << endl;
}

int main() {
    IOS;
    int h_h = 1;
    //cin >> h_h;
    while (h_h--)solve();
    return 0;
}

E 唤

这才是纯纯的贪心,首先456的方块看到要独自占一个,剩下的用1和2去补齐,3的方块全部用来构造6的方块,不够的那也用1和2去补齐,如果2填完了前面的还多出来,2还要单独去构成6的方块,不够的用1去补齐,最后1填完了前面的多出来,再用1去构造6的方块

/*
    Author : north_h
    File : E.cpp
    Time : 2023/7/26/14:58
                    _   _         _
   _ __   ___  _ __| |_| |__     | |__
  | '_ \ / _ \| '__| __| '_ \    | '_ \
  | | | | (_) | |  | |_| | | |   | | | |
  |_| |_|\___/|_|   \__|_| |_|___|_| |_|
                            |_____|
*/
#pragma GCC optimize(3)

#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr), cout.tie(nullptr);
#define met_0(a) memset(a,0,sizeof a)
#define met_1(a) memset(a,-1,sizeof a)
#define met_x(a) memset(a,0x3f,sizeof a)
#define mpy(a, b) memcopy(a,sizeof b,b)
#define int long long
#define ld long double
#define ull unsigned long long
#define fi first
#define se second
#define PII pair<int,int>
#define PDD pair<double,double>
#define PCI pair<char,int>
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.begin(),a.end()
#define int128 __int128
#define endl '\n'
const int N = 10010;
const int M = 110;
const int MOD = 998244353;
const int EPS = 1e-8;
const int INF = 0x3f3f3f3f;

using namespace std;

void solve() {
    int s;
    cin >> s;
    int a1, a2, a3, a4, a5, a6;
    cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
    int sum = a6 + a5 + a4 + (a3 + 3) / 4;
    int cnt2 = a4 * 5;
    if (a3 % 4 == 1)cnt2 += 5;
    else if (a3 % 4 == 2)cnt2 += 3;
    else if (a3 % 4 == 3)cnt2++;
    int cnt1 = 11 * a5;
    if (a3 % 4 == 1)cnt1 += 7;
    else if (a3 % 4 == 2)cnt1 += 6;
    else if (a3 % 4 == 3)cnt1 += 5;
    if (a2 > cnt2) {
        a2 -= cnt2;
        int cnt = (a2 + 8) / 9;
        sum += cnt;
        int y = (cnt * 9 - a2);
        cnt1 += y * 4;
    } else {
        int cnt = cnt2 - a2;
        cnt1 += cnt * 4;
    }
    a1 = max(0ll, a1 - cnt1);
    sum += (a1 + 35) / 36;
    if (sum <= s)cout << "Yes" << endl;
    else cout << "No" << endl;
}

int32_t main() {
    IOS;
    int h_h = 1;
    cin >> h_h;
    while (h_h--)solve();
    return 0;
}