蓝桥算法训练营—普及组—2023年2.5日
标题 蓝桥算法训练营—普及组—2023年2.5日
目录
https://www.luogu.com.cn/problem/P2694
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n;
PII q[N];
bool cmp(PII a,PII b)
{
return a.y < b.y;
}
void solve()
{
cin>>n;
for(int i=0;i<n;i ++ )
{
cin>>q[i].x>>q[i].y;
}
sort(q,q+n,cmp);
LL t =0,cnt=0;bool flag=0;
for(int i=0;i <n ;i ++ )
{
if(abs(t-q[i].x) > q[i].y - cnt)
{
flag =1 ;break;
}
cnt=q[i].y;
t = q[i].x;
}
if(flag ) puts("Notabletocatch");
else puts("Abletocatch");
}
int main()
{
ios
int T;cin>>T;
while(T -- )
{
solve();
}
return 0;
}
P1372 又是毕业季I
https://www.luogu.com.cn/problem/P1372
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n,m;
PII q[N];
void solve()
{
cin>>n>>m;
cout<<n /m <<endl;
}
int main()
{
ios
int T=1;
// cin>>T;
while(T -- )
{
solve();
}
return 0;
}
P1106 删数问题
https://www.luogu.com.cn/problem/P1106
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n,m;
PII q[N];
void solve()
{
string s;cin>>s>>n;
while(n -- )
{
bool flag =0;
for(int i=0;i < s.size() -1 ;i ++ )
{
if(s[i] > s[i + 1])
{
flag =1;
s = s.substr(0,i) + s.substr(i+1);
// 删掉 第 i 个数
break;
}
}
if(!flag) // 没有找到 要删的 数 说明 这个从前往后 是 递增的
s = s.substr(0,s.size()-1) ; // 否则删掉 最后一个 数
}
int i=0;
while(i < s.size() && s[i] == '0') i ++ ;
if(i == s.size()) cout<<0 << endl;
else
{
for(int j =i;j <s.size() ; j++)cout<<s[j];
}
}
int main()
{
ios
int T=1;
// cin>>T;
while(T -- )
{
solve();
}
return 0;
}
谈判
https://www.lanqiao.cn/problems/545/learning/
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n,m;
priority_queue<int,vector<int>,greater<int>> q;
void solve()
{
cin>>n;
for(int i=0; i< n ;i ++ )
{
int t;cin>>t;
q.push(t);
}
LL res=0;
while(q.size() > 1)
{
auto x = q.top(); q.pop();
auto y = q.top();q.pop();
res += (LL)x+y;
q.push(x +y);
}
cout << res << endl;
}
int main()
{
ios
int T=1;
// cin>>T;
while(T -- )
{
solve();
}
return 0;
}
...全文
相关推荐
2023年4月8日蓝桥杯c++ABC组题目大全
其中是2023年4月8号的蓝桥杯c++的ABC组的题目,以pdf形式展现:
2023年蓝桥杯省赛Java语言大学A组真题.doc
2023年蓝桥杯省赛Java语言大学A组真题.doc
蓝桥杯历年真题及其解析:覆盖从2023年至2024年的C/C++程序竞赛试题
内容概要:本文汇总了2024年第十五届蓝桥杯软件类赛事以及2023年及之前的C/C++竞赛题目,涉及各类题目如‘训练士兵’、‘团建’、‘好数’等不同级别的问题,涵盖了简单的数字运算到复杂的数论、图形操作等方面的内容。不仅展示了多种类型的挑战项目,还提供了解决每道试题的基本思路。 适合人群:备战蓝桥杯或其他编程比赛的学生,希望提升自身解题能力的程序员。 使用场景及目标:帮助参与者熟悉比赛流程与规则,强化数据结构与算法应用技能。 阅读建议:考生应当深入研究每一题的特点与解答方法,利用官方提供的试题解析材料辅助理解和练习。此外,建议结合相关书籍资料进一步深化对特定知识点的理解。
2023年3月份的蓝桥杯STEMA测评真题.pdf
2023年3月份的蓝桥杯STEMA测评真题
2023年蓝桥杯第六届C语言真题汇总.doc
2023年蓝桥杯第六届C语言真题汇总.doc


