目录

A

签到

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define fep(i,a,b) for(int i = (a); i >= (b); --i)
#define ls p<<1
#define rs p<<1|1
#define PII pair<int, int>
#define ll long long
#define ull unsigned long long
#define db double
#define endl '\n'
#define debug(a) cout<<#a<<"="<<a<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 0x3f3f3f3f
#define x first
#define y second
using namespace std; const int N=5e5+10; void solve()
{
string str;cin>>str;
bool st=true;
rep(i,0,str.size()-1)
{
if(!i)
{
if(str[i]>='A'&&str[i]<='Z') continue;
else
{
cout<<"No"<<endl;
return;
}
}
if(str[i]>='a'&&str[i]<='z') continue;
else
{
cout<<"No"<<endl;
return;
}
}
cout<<"Yes"<<endl;
} int main()
{
IOS
// freopen("1.in", "r", stdin);
int t;
// cin>>t;
// while(t--)
solve();
return 0;
}

B

签到题

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define fep(i,a,b) for(int i = (a); i >= (b); --i)
#define ls p<<1
#define rs p<<1|1
#define PII pair<int, int>
#define ll long long
#define ull unsigned long long
#define db double
#define endl '\n'
#define debug(a) cout<<#a<<"="<<a<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 0x3f3f3f3f
#define x first
#define y second
using namespace std; const int N=5e5+10; void solve()
{
string str;cin>>str;
map<char,int>cnt;
for(auto c:str) cnt[c]++;
char c;
int k=0;
for(auto it:cnt)
{
if(it.y>k)
{
k=it.y;
c=it.x;
}
}
cout<<c<<endl;
} int main()
{
IOS
// freopen("1.in", "r", stdin);
int t;
// cin>>t;
// while(t--)
solve();
return 0;
}

C题

观察到数据范围n只有10,想到去枚举a的数量然后去看b最多能做多少。

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define fep(i,a,b) for(int i = (a); i >= (b); --i)
#define ls p<<1
#define rs p<<1|1
#define PII pair<int, int>
#define ll long long
#define ull unsigned long long
#define db double
#define endl '\n'
#define debug(a) cout<<#a<<"="<<a<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 0x3f3f3f3f
#define x first
#define y second
using namespace std; const int N=20;
int c[N],a[N],b[N],n; bool check1(int x)
{
rep(i,1,n) if(x*a[i]>c[i]) return false;
return true;
} void solve()
{
cin>>n;
int sa=0,sb=0,sc=0;
rep(i,1,n) cin>>c[i],sc+=c[i];
rep(i,1,n) cin>>a[i],sa+=a[i];
rep(i,1,n) cin>>b[i],sb+=b[i];
int ans=0;
rep(gg,0,1e6)
{
if(!check1(gg)) break;
int kk=1e6;
rep(i,1,n)
{
if(b[i]==0) continue;
int xx=c[i]-a[i]*gg;
xx/=b[i];
kk=min(kk,xx);
}
ans=max(ans,gg+kk);
}
cout<<ans<<endl;
} int main()
{
IOS
// freopen("1.in", "r", stdin);
// int t;
// cin>>t;
// while(t--)
solve();
return 0;
}

D题

也很巧妙,贡献法的思想。

对于每一个路径计算他对不同断桥产生的贡献。

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define fep(i,a,b) for(int i = (a); i >= (b); --i)
#define ls p<<1
#define rs p<<1|1
#define PII pair<int, int>
#define ll long long
#define ull unsigned long long
#define db double
#define endl '\n'
#define debug(a) cout<<#a<<"="<<a<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 0x3f3f3f3f
#define x first
#define y second
using namespace std; const int N=1e6+10; ll n,m,x[N],cf[N]; ll dist(ll x,ll y)
{
if(x<=y) return y-x;
else return n-(x-y);
} void add(ll x,ll y,ll d)
{
if(x<=y)
{
cf[x]+=d;
cf[y]-=d;
}
else
{
cf[x]+=d;
cf[n+1]-=d;
cf[1]+=d;
cf[y]-=d;
}
} void solve()
{
cin>>n>>m;
rep(i,1,m) cin>>x[i];
rep(i,1,m-1)
{
add(x[i],x[i+1],dist(x[i+1],x[i]));
add(x[i+1],x[i],dist(x[i],x[i+1]));
}
ll ans=1e18;
rep(i,1,n) cf[i]+=cf[i-1];
rep(i,1,n) ans=min(ans,cf[i]);
cout<<ans<<endl;
} int main()
{
IOS
// freopen("1.in", "r", stdin);
int t;
// cin>>t;
// while(t--)
solve();
return 0;
}

E题

#include <bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define fep(i,a,b) for(int i = (a); i >= (b); --i)
#define ls p<<1
#define rs p<<1|1
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ll long long
#define ull unsigned long long
#define db double
#define endl '\n'
#define debug(a) cout<<#a<<"="<<a<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 0x3f3f3f3f
#define x first
#define y second
#define pb push_back using namespace std;
const int N=4e5+10;
int cf[N],x[N],y[N]; void solve()
{
int n;cin>>n;
rep(i,1,n)
{
cin>>x[i]>>y[i];
if(x[i]>y[i]) swap(x[i],y[i]);
cf[x[i]]+=1;cf[y[i]+1]-=1;
}
rep(i,1,2*n) cf[i]+=cf[i-1];
rep(i,1,n)
{
if(cf[x[i]]!=cf[y[i]])
{
cout<<"Yes"<<endl;
return;
}
}
cout<<"No"<<endl;
}
signed main()
{
IOS
// freopen("1.in", "r", stdin);
// int _;
// cin>>_;
// while(_--)
solve();
return 0;
}

AtCoder Beginner Contest 338(A~E补题)的更多相关文章

  1. AtCoder Beginner Contest 188 F - +1-1x2 思维题

    题目描述 给你两个数 \(x\),\(y\) 可以对 \(x\) 进行 \(+1,-1\) 或 \(\times 2\) 的操作 问最少操作多少次后变为 \(y\) \(x,y \leq 10^{18 ...

  2. AtCoder Beginner Contest 137 F

    AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) ...

  3. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  4. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  5. AtCoder Beginner Contest 223

    AtCoder Beginner Contest 223 A是纯纯的水题,就不说了 B - String Shifting 思路分析 我真的sb,一开始想了好久是不是和全排列有关,然后读了好几遍题目也 ...

  6. AtCoder Beginner Contest 064 D - Insertion

    AtCoder Beginner Contest 064 D - Insertion Problem Statement You are given a string S of length N co ...

  7. AtCoder Beginner Contest 075 C bridge【图论求桥】

    AtCoder Beginner Contest 075 C bridge 桥就是指图中这样的边,删除它以后整个图不连通.本题就是求桥个数的裸题. dfn[u]指在dfs中搜索到u节点的次序值,low ...

  8. AtCoder Beginner Contest 224

    AtCoder Beginner Contest 224 A - Tires 思路分析: 判断最后一个字符即可. 代码如下: #include <bits/stdc++.h> using ...

  9. KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解

    KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解 哦淦我已经菜到被ABC吊打了. A - Century 首先把当前年 ...

  10. AtCoder Beginner Contest 100 2018/06/16

    A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...

随机推荐

  1. C# 输入指定日期获取当前年的第一天 、当前年的最后天、某月的第一天 、某月的最后一天

    方法 /// <summary> /// 取得当前年的第一天 /// </summary> /// <param name="datetime"> ...

  2. C# 中类与继承等概念

    C#是一种现代的.面向对象的编程语言,其中类和继承是面向对象编程语言中非常重要的概念,类和继承是C#中面向对象编程的基本概念,可以用于创建复杂的应用程序和模块,而多态和接口可以使程序更加灵活和可扩展. ...

  3. 给textarea添加行号,textarea使用代码风格的一些思考

    背景 项目有个需求是 在textarea中编辑脚本并显示为代码风格样式,显示行号: textarea显示行号 思路: 1.监听textarea内容变化,执行一个change函数,解析内容里面有多少个换 ...

  4. 三星发布990 EVO SSD:同时支持PCIe 4.0和PCIe 5.0

    1月8日消息,三星发布了新款产品--990 EVO SSD,这是首款同时支持了PCIe 4.0 x4及PCIe 5.0 x2通道的SSD. 据了解,990 EVO面向中端市场,为2280 M.2规格, ...

  5. Vite4+Typescript+Vue3+Pinia 从零搭建(1) - 项目初始化

    项目代码同步至码云 weiz-vue3-template 前提准备 1. node版本 Node.js版本 >= 12,如果有老项目需要旧版本的,推荐用 nvm 管理node版本. PS C:\ ...

  6. CF911G Mass Change Queries 题解

    题目链接:CF 或者 洛谷 前置知识点:平衡树合并: CF文章 与维基百科 看上去这题有很多人用线段树分裂与合并去做,其实这种需要分裂和合并的,我们用文艺平衡树去维护区间信息是最容易写的. 考虑本题的 ...

  7. P5309 [Ynoi2011] 初始化 题解

    题目链接:初始化 这种 ynoi 的老题就是卡常.来简单说说这题的思维切入口. 看到形如 \(y+k \times x\) 的结构,自然而然思考一下如果我们是暴力更新会有怎么样的效果.我们容易发现,如 ...

  8. DoraCloud桌面模板制作教程

    模板制作是桌面云部署时的一项重要工作.模板的质量直接影响到虚拟桌面业务运行的稳定性.安全性和用户体验.制作模板需要完成如下一些工作: 安装Windows桌面操作系统. 安装虚拟化平台相关的半虚拟化驱动 ...

  9. (C语言)每日代码||2023.12.25||strcpy()函数两个参数中的'\0'

    #include <stdio.h> #include <string.h> #define MAX 500 void test() { char arr1[] = { '1' ...

  10. 下载安装JDK 和 IntelliJ IDEA 和 ActiveMq

    wget http://yun.diandaxia.com/other/jdk-8u92-linux-x64.rpm rpm -ivh jdk-8u92-linux-x64.rpm wget http ...