首页 > 其他分享 >天梯赛真题补题单(L1-1 ~ L1-5)

天梯赛真题补题单(L1-1 ~ L1-5)

时间:2024-04-14 19:34:19浏览次数:18  
标签:typedef const LL cin long 赛真题 补题 L1 tie

L1-1 寻找250

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=100200,M=2020;
const double PI=3.141592;
int main()
{
    //cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL x;
        LL idx=0;
        while(cin>>x)
        {
            idx++;
            if(x==250)
            {
                cout<<idx<<endl;
                break;
            }
        }
    }
    return 0;
}

L1-2 日期格式化

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=100200,M=2020;
const double PI=3.141592;
int main()
{
    //cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL a,b,c;
        char s1,s2;
        scanf("%d-%d-%d",&a,&b,&c);
        printf("%d-%02d-%02d",c,a,b);
    }
    return 0;
}

L1-3 阅览室

注意小细节

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=100200,M=2020;
const double PI=3.141592;
struct node
{
    LL first=-1,second=-1;
}mp[1050];
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL t;
        cin>>t;
        LL sum=0,avg=0;
        for(int i=1;i<=t;i++)
        {
            for(int i=0;i<=1024;i++)
            {
                mp[i].first=-1;
                mp[i].second=-1;
            }
            while(1)
            {
                LL x;
                string s;
                LL a,b;
                char c;
                cin>>x>>s>>a>>c>>b;
                if(x!=0)
                {
                    LL num=a*60+b;
                    if(s=="S") mp[x].first=num;
                    else
                    {
                        if(mp[x].first!=-1)
                        {
                            mp[x].second=num;
                            sum++;
                            avg+=abs(mp[x].first-mp[x].second);
                            mp[x].first=-1;
                            mp[x].second=-1;
                        }
                    }
                }
                else
                {
                    if(sum!=0)
                    {
                        printf("%lld %.0lf\n",sum,(double)avg/sum);
                    }
                    else printf("0 0\n");
                    sum=0,avg=0;
                    break;
                }
            }
        }
    }
    return 0;
}

L1-4 稳赢

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=100200,M=2020;
const double PI=3.141592;
int main()
{
    //cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL t;
        cin>>t;
        string s;
        LL idx=0;
        while(cin>>s)
        {
            if(s=="End") break;
            idx++;
            if(idx%(t+1)==0) cout<<s<<endl;
            else
            {
                if(s=="ChuiZi") cout<<"Bu"<<endl;
                else if(s=="JianDao") cout<<"ChuiZi"<<endl;
                else cout<<"JianDao"<<endl;
            }
        }
    }
    return 0;
}

L1-5 宇宙无敌大招呼

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=100200,M=2020;
const double PI=3.141592;
int main()
{
    //cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        string s;
        cin>>s;
        cout<<"Hello "<<s<<endl;
    }
    return 0;
}

标签:typedef,const,LL,cin,long,赛真题,补题,L1,tie
From: https://www.cnblogs.com/Vivian-0918/p/18134555

相关文章

  • EL1205 电子工程实践
    免责声明:本评估简报中提供的信息在发布时是正确的。在不太可能的情况下,任何变化如有必要,将通过电子邮件进行明确沟通,并分发新版评估简报。学年:2023/24评估简介:课程电子工程学士(荣誉)模块代码:EL1205课程名称:电子工程实践简报标题:设计与构建:RS232字符生成器评估类型:课程此评估包包括......
  • 模拟开关芯片 BL1551B中文资料 BL1551B引脚图及功能说明
     BL1551B是一款由贝岭(上海)微电子技术有限公司(ShanghaiBellingCo.,Ltd.)生产的模拟开关芯片。以下是关于BL1551B的功能和参数介绍:功能:BL1551B是一款高性能、低功耗的模拟开关芯片,适用于音频、视频和其他模拟信号的切换和控制。内置两个单刀双掷(SPDT)开关,可实现两路信......
  • 第十二届蓝桥杯省赛真题(C/C++大学B组)
    目录#A空间#B卡片#C直线#D货物摆放#E路径#F时间显示#G砝码称重#H 杨辉三角形#I双向排序#J括号序列#A空间#include<bits/stdc++.h>usingnamespacestd;intmain(){ cout<<256*1024*1024/4<<endl; return0;}#B卡片#include<bit......
  • 2024SMU蓝桥训练2补题
    C-密文搜索思路:不难。voidsolve(){//C--密文搜索可以不是字符串哈希--因为只需要知道相同长度字符串对字母出现情况,可以对字符串进行!!!排序!!!stringstr;cin>>str;intn,ans=0;cin>>n;unordered_map<string,int>mp;for(inti=1;i<=n;i++){......
  • 解决keil单片编程ERROR L107: ADDRESS SPACE OVERFLOW问题及根源分析
    1、将部分声明的不需要修改的变量声明为程序存储器变量,即在变量名前增加code关键字,如:unsignedcharcodeled_mod[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};当然,我们也可以使用关键字xdata将数据存储到片......
  • 2024.4.9 图论补题
    P3225[HNOI2012]矿场搭建如果没有割点,至少需要建立两个出口如果只有一个割点,只需要设立一个出口如果有两个及以上个割点,则无需建立,可以直接到达其他联通块#include<cmath>#include<queue>#include<cstdio>#include<vector>#include<cstdlib>#include<cstring>#include......
  • 2024.4.8 数据结构课件补题
    [AGC055B]ABCSupremacy令ABC分别为1,2,3,然后令\(s_i=(s_i-i)\textmod3\)且结果大于0。然后可以发现三种组合均为连贯的三个相同数。且可以自由移动。可以选择每遇到三个相同数就删掉,或者不断加入栈,如果栈顶三个数相同全部弹出。再比较剩下的数即可。#include<bits......
  • 2024/4/8 课件补题
    2024/4/8课件补题[AGC055B]ABCSupremacy思维题。发现所有的\(ABC\),\(BCA\),\(CAB\)都可以任意向左向右移动,所以只需要把所有的\(ABC\)挪到字符串结尾即可,具体操作时可以删掉再比对\(s\)和\(t\)是否相同。#include<bits/stdc++.h>usingnamespacestd;#defineld......
  • WebSocket manager.js:115 GET http://IP:8000/socket.io/?EIO=4&transport=polling&t
    前言全局说明WebSocket报错net::ERR_CONNECTION_TIMED_OUT一、问题:WebSocket报错net::ERR_CONNECTION_TIMED_OUT二、原因:可能和后端的服务链接不上导致的三、解决方法:重启启动后端服务免责声明:本号所涉及内容仅供安全研究与教学使用,如出现其他风险,后......
  • LCD显示驱动/低功耗液晶段码屏驱动芯片VKL144D SSOP48 原厂技术支持
    产品品牌:永嘉微电/VINKA产品型号:VKL144D封装形式:SSOP48概述VKL144D是一个点阵式存储映射的LCD驱动器,可支持最大144点(36SEGx4COM)的LCD屏。单片机可通过I2C接口配置显示参数和读写显示数据,可配置4种功耗模式,也可通过关显示和关振荡器进入省电模式。其高抗干扰,低功耗的特性适用......