首页 > 其他分享 >西南民族大学 春季 2023 训练赛 6

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

时间:2023-04-11 23:33:07浏览次数:48  
标签:cout int cin 春季 pintia 60 训练赛 2023 include

题目详情 - 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)

标签:cout,int,cin,春季,pintia,60,训练赛,2023,include
From: https://www.cnblogs.com/Kescholar/p/17308279.html

相关文章

  • 2023-04-11 无向图的匹配问题
    无向图的匹配问题之所以把无向图的这个匹配问题放到最后讲是因为匹配问题借鉴了有向图中一些算法的思想1最大匹配和完美匹配二分图回顾二分图:把一个图中的所有顶点分成两部分,如果每条边的两端分别属于不同部分,则这个图是二分图。更多二分图内容参考第4章二分图相关最大......
  • 2023.4.11——团队任务日报
    认领的工作任务:工作任务预估时间1.角色管理—教师身份(6.5h)2.调用接口,调用摄像头实现人脸识别(4h) ......
  • 矩阵乘法的随机自规约 (平原秀一, 清水伸高, 2023)
    随机自规约(randomself-reduction)说的是这样一件事:对于一个函数\(f\),如果我们有一个算法\(A\)能够高效地对于随机的输入以一定概率计算出正确的结果,那么我们就能通过调用\(A\)在任意输入上都以一定概率计算出正确的结果.比如限定有限域\(\mathbbF\)上的\(n\)......
  • java学习日记20230410-List
    List接口基本介绍List集合类中元素有序,即添加顺序和取出顺序一致,且可重复;List集合中的每隔元素都有其对应的顺序索引,即支持索引List容器中的元素都对应一个整数型的序号记载其在容器中的位置,可以根据序号存取容器中的元素JDKAPI中List接口的实现类有:ArrayListLinkedListVe......
  • NKCTF2023
    NKCTF2023ez_baby_apk是一个apk文件,用jadx打开。key是reversecarefully将e替换成3,iv是reversehavemagic的md5的值,然后使用DES加密,不过这个DES加密是自己写的其实他并不是真正的DES。就是名字一样而已可以看到是AES加base64加密。(密文是使用jadx的其他窗口来查找的,在代码窗口......
  • Javaweb-登录界面-filter配合案例-2023-04-11
    1、新建login.jsp登录界面响应的路径<%@pagecontentType="text/html;charset=UTF-8"language="java"%><html><head><title>Login</title></head><body><h1>登录界面</h1><hr><form......
  • day42(2023.4.11)
    1.数据库基本概念2.数据库中,各个概念之间的关系3.数据库分类4.MySQL简介、特点、以及分类 5.下载MySQL   6.MySQL的安装与卸载 7.连接MySQL  8.Navicat工具由于MySQL自带的客户端工具(就是那个黑窗口),有点小小的简陋,也不怎么好看。我们可以......
  • 2023年4月11日(软件工程日报)
    深度学习进步之处由sigmid函数,转变为RELU函数,由于梯度下降原因,sigmid函数后期学习非常缓慢,但relu函数可以避免这种情况损失函数,用于衡量单一训练样例效果 逻辑回归中用到的损失函数是:......
  • 2023.4.11——软件工程日报
    所花时间(包括上课):8h代码量(行):0行博客量(篇):1篇今天,上午学习,下午学习。我了解到的知识点:1.学习了python,并了解了一些关于python的知识;2.了解了一些数据库的知识;......
  • 2023/4/11
    判断某年是否是闰年问题#include<iostream>usingnamespacestd;intmain(){ intyear;cout<<"Entertheyear:";cin>>year;boolisaleapyear;isaleapyear=((year%4==0&&year%100!=0)||(year%400==0));if(isaleapyear)cout<<year<<&quo......