西南民族大学 春季 2023 训练赛 6

发布时间 2023-04-11 23:30:14作者: Ke_scholar

题目详情 - L1-1 今天我要赢 (pintia.cn)

void solve()
{
    cout << "I'm gonna win! Today!" << endl;
    cout << "2022-04-23" << endl;
}

题目详情 - L1-2 种钻石 (pintia.cn)

void solve()
{
    int v;
    cin >> n >>  v;
    cout << n / v << endl;
}

题目详情 - L1-3 谁能进图书馆 (pintia.cn)

int n,m,t,sa,pa,q1,q2;

void solve()
{
    cin >> sa >> pa >> q1 >> q2 ;
    if(q1 >= sa && q2 >= sa)
    {
        cout << q1 << "-Y " << q2 << "-Y" << endl;
        cout << "huan ying ru guan" << endl;
    }
    else if(q1 >= pa)
    {
        cout << q1 << "-Y " << q2 << "-Y" << endl;
        cout << "qing 1 zhao gu hao 2" << endl;
    }
    else if(q2 >= pa)
    {
        cout << q1 << "-Y " << q2 << "-Y" << endl;
        cout << "qing 2 zhao gu hao 1" << endl;
    }
    else if(q1 >= sa)
    {
        cout << q1 << "-Y " << q2 << "-N" << endl;
        cout << "1: huan ying ru guan" << endl;
    }
    else if(q2 >= sa)
    {
        cout << q1 << "-N " << q2 << "-Y" << endl;
        cout << "2: huan ying ru guan" << endl;
    }
    else
    {
        cout << q1 << "-N " << q2 << "-N" << endl;
        cout << "zhang da zai lai ba" << endl;
    }
}

题目详情 - L1-4 拯救外星人 (pintia.cn)

int n,m,t,sa,pa,q1,q2;

void solve()
{
    cin >> n >> m;
    int ans = 1;
    for(int i = 1; i <= n +m; i++)
     ans *= i;
    cout << ans << endl;
}

题目详情 - L1-5 试试手气 (pintia.cn)

int n,m,t,sa,pa,q1,q2;
int a[6];
void solve()
{
    for(int i = 0; i <6 ;i ++)
     cin >> a[i];
    cin >> n;
    for(int j = 0; j < 6;j ++)
    {
        int d = n;
    for(int i = 6; i > 0; i--)
    {
         if(i == a[j])
         continue;
         d--;
         if(d == 0)
         {
             cout << i << (j == 5 ? "\n" : " ");
             break; 
         }
    }     
    }
    
}

题目详情 - L1-6 斯德哥尔摩火车上的题 (pintia.cn)

void solve()
{
    string s1,s2,ans1 = "", ans2 = "";
    cin >> s1 >> s2;
    for (int i = 1; i < s1.size(); i++) {
      if (s1[i] % 2 == s1[i-1] % 2) {
        ans1 += max(s1[i], s1[i-1]);
          }
    }
    for (int i = 1; i < s2.size(); i++) {
      if (s2[i] % 2 == s2[i-1] % 2) {
        ans2 += max(s2[i], s2[i-1]);
          }
    }
    if(ans1 == ans2)
     cout << ans1 << endl;
    else
    {
        cout << ans1 << endl << ans2 << endl;
    } 
}

题目详情 - L1-7 机工士姆斯塔迪奥 (pintia.cn)

总格数就相当于把BOSS攻击的行和列放在最边上,最后计算被截下的长方形格数即可,BOSS会攻击已经攻击过得行和列,所以要判定该行/列是否被攻击过

int hang[N], lie[N];
void solve()
{
    cin >> n >> m >> q;
    int ans = n * m;
    int d = q;
    while(q--)
    {
        int c;
        cin >> t >> c;
        if(t)
        {
            if(!lie[c])
            m--;     
            lie[c] = 1;
        
        }
        else
        {
            if(!hang[c])
             n--;
            hang[c] = 1;
                       
        }
    } 
    cout << n * m   << endl;
}

题目详情 - L1-8 静静的推荐 (pintia.cn)

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <set>
#include <utility>
#define inf 0x3f3f3f3f
#define endl '\n'
#define int long long
#define f first
#define s second

using namespace std;

const int N = 1e5+10, M = 1e6 + 10;

//typedef long long ll;
typedef pair<int,int> PII;
//queue<PII> q1;
//priority_queue <int,vector<int>,greater<int> > q2;
int n,m,t,sa,pa,q,k,sorce,pat[N];
/*
*/
struct Sorce{
    int ss,pat;
    bool operator < (const Sorce &s) const{
        if(s.ss != ss) return pat < s.pat;
        return ss < s.ss;
    }
};
vector<Sorce> sr(N);
bool vis[N];
int enough[N];
void solve()
{
    cin >> n >> k >> sorce;
    int ans = 0;
    for(int i = 0; i < n; i++) 
    {
        int x,y;
        cin >> x >> y;
        if(x >= 175 && y >= sorce)
        {
            ans ++;
            continue;
        }
        sr.push_back({x, y});
        //cin >> sorce[i] >> pat[i];         
    }
    sort(sr.begin(), sr.end()); 
    t = 0;
    for(int i = 0 ; i < sr.size(); i++)
    {
        if(sr[i].ss < 175)
         continue;
         t = max(t, sr[i].ss);
        enough[sr[i].ss - 175] ++; 
    }
    t -= 175;
    for(int i = 0; i <= t; i++)
    {
        //cout << enough[i] << ' ';
        if(enough[i] >= k)
         ans += k;
        else
         ans += enough[i];
    }
    cout << ans << endl; 
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int Ke_scholar  = 1;
    while(Ke_scholar--)
    {
       solve();
    }
    return 0;
}

题目详情 - L2-1 插松枝 (pintia.cn)

题目详情 - L2-2 老板的作息表 (pintia.cn)

将输入的时间换算成秒进行排序,如果这段区间的起始时间和上一段的结束时间相等就跳过,否则就输出

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <set>
#include <utility>
#define inf 0x3f3f3f3f
#define endl '\n'
#define int long long
#define f first
#define s second

using namespace std;

const int N = 1e6+10, M = 1e6 + 10;

//typedef long long ll;
typedef pair<int,int> PII;
//queue<PII> q1;
//priority_queue <int,vector<int>,greater<int> > q2;
int n,m,t,sa,pa,q,k,sorce,pat[N];
/*
*/
bool vis[N],st[N];
vector<PII> a;
void solve()
{
    cin >> n;
    a.push_back({0,0});
    a.push_back({24 * 60 * 60 - 1, 24 * 60 * 60 - 1});
    while(n--) {
        char c1, c2, c3, c4, c5;
        int h1, h2, m1, m2, s1, s2;
        cin >> h1 >> c1 >> m1 >> c2 >> s1 >> c3 >> h2 >> c4 >> m2 >> c5 >> s2;
        a.push_back({(h1 * 60 + m1) * 60 + s1, (h2 * 60 + m2) * 60 + s2});
    }
    sort(a.begin(), a.end());
    for(int i = 1;i < a.size(); i ++)
    {
        if(a[i].f == a[i - 1].s)
            continue;
        int h = a[i].f / (60 * 60), m = a[i].f % 3600 / 60, s = a[i].f % 60;
        int h0 = a[i - 1].s / (60 * 60), m0 = a[i - 1].s % 3600 / 60, s0 = a[i - 1].s % 60;
        printf("%02d:%02d:%02d - ",h0,m0,s0);
        printf("%02d:%02d:%02d\n",h,m,s);
    }

}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int Ke_scholar  = 1;
    while(Ke_scholar--)
    {
        solve();
    }
    return 0;
}

题目详情 - L2-3 龙龙送外卖 (pintia.cn)

题目详情 - L2-4 大众情人 (pintia.cn)