Codeforces Round #573
http://codeforces.com/contest/1191
A
给一个数,可以加0,1或2然后取模,再映射到字母,字母有排名,求最大排名。
总共只有4种情况,讨论即可
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define ll long long
#define fo(i,l,r) for(int i = l;i <= r;i++)
#define fd(i,l,r) for(int i = r;i >= l;i--)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn = ;
const ll inf = 987654321234500LL;
const ll mod = 1e9+;
ll n;
ll read() {
ll x=,f=;
char ch=getchar();
while(!(ch>=''&&ch<='')) {
if(ch=='-')f=-;
ch=getchar();
};
while(ch>=''&&ch<='') {
x=x*+(ch-'');
ch=getchar();
};
return x*f;
}
int tran[]={,,,};
int main() {
n=read();
int mx,dd;
n %= ;
if(n==){
dd=;
mx = ;
}
if(n==){
dd = ;
mx = ;
}
if(n==){
dd = ;
mx = ;
}
if(n==){
dd = ;
mx = ;
}
cout<<dd<<" "<<(char)('A'+mx);
return ;
}
B
一副牌,看看有没有三张一样的牌或者三张连号的牌
遍历
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define ll long long
#define fo(i,l,r) for(int i = l;i <= r;i++)
#define fd(i,l,r) for(int i = r;i >= l;i--)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn = ;
const ll inf = 987654321234500LL;
const ll mod = 1e9+;
ll n;
ll read() {
ll x=,f=;
char ch=getchar();
while(!(ch>=''&&ch<='')) {
if(ch=='-')f=-;
ch=getchar();
};
while(ch>=''&&ch<='') {
x=x*+(ch-'');
ch=getchar();
};
return x*f;
}
char a[][];
int p[][];
int main() {
scanf("%s %s %s",a[],a[],a[]);
fo(i,,){
int hs = ;
if(a[i][]=='m')hs=;
if(a[i][]=='p')hs=;
if(a[i][]=='s')hs=;
p[hs][a[i][]-'']++;
}
int ans = ;
fo(i,,){
fo(j,,){
ans = min(ans,-p[i][j]);
}
fo(j,,){
ans = min(ans,-((p[i][j]>=)+(p[i][j+]>=)+(p[i][j+]>=)));
}
}
cout<<ans;
return ;
}
C
一个纸带,分成若干段,把一些位置标记,每轮把第一个有标记的段的所有标记位置拿走,后面的位置向前顺延,问多少次取完
这个标记段是不断后移的,算一下下次在哪个段就行了
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define ll long long
#define fo(i,l,r) for(int i = l;i <= r;i++)
#define fd(i,l,r) for(int i = r;i >= l;i--)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn = ;
const ll inf = 987654321234500LL;
const ll mod = 1e9+;
ll read() {
ll x=,f=;
char ch=getchar();
while(!(ch>=''&&ch<='')) {
if(ch=='-')f=-;
ch=getchar();
};
while(ch>=''&&ch<='') {
x=x*+(ch-'');
ch=getchar();
};
return x*f;
}
ll n,m,k;
ll p[maxn];
ll lp,rp;
int main() {
n=read();
m=read();
k=read();
fo(i,,m){
p[i]=read();
}
lp = ;
rp = k;
ll hasp=,nowhp;
ll ans = ;
ll pos = ;
while(pos <= m){
nowhp=;
while(pos <= m && p[pos]-hasp<=rp){
nowhp++;
pos++;
}
if(nowhp)ans++;
hasp += nowhp;
if(rp < p[pos]-hasp){
ll tmp = (p[pos]-hasp-rp);
tmp = (tmp-)/k + ;
tmp *= k;
lp += tmp;
rp += tmp;
}
}
cout<<ans;
return ;
}
D
有n堆石子,两人轮流从一堆里取一块,什么时候取不了了,或者有两堆高度一样的(包括0),那这个人就输了。问谁赢。
假设先手面临的不是必败态,最后的必败态是0、1、2、3...n这种情况,看谁先到达。
先手必败有哪些?都是0的,和包含相同的,如果包含一个相同的对,其他再没有相同的对,并且这一对不是0,且没有恰好比它们高度小1的堆,那就不是必败,否则是必败。
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define ll long long
#define fo(i,l,r) for(int i = l;i <= r;i++)
#define fd(i,l,r) for(int i = r;i >= l;i--)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn = ;
const ll inf = 987654321234500LL;
const ll mod = 1e9+;
ll read() {
ll x=,f=;
char ch=getchar();
while(!(ch>=''&&ch<='')) {
if(ch=='-')f=-;
ch=getchar();
};
while(ch>=''&&ch<='') {
x=x*+(ch-'');
ch=getchar();
};
return x*f;
}
int n;
ll a[maxn];
int main() {
n=read();
fo(i,,n){
a[i]=read();
}
sort(a+,a++n);
ll cnt = ;
fo(i,,n-){
if(a[i]==a[i+]){
cnt++;
if(a[i]==)cnt++;
if(i > && a[i]==a[i-]+)cnt++;
}
}
if(cnt > ){
cout<<"cslnb";
return ;
}
cnt = ;
fo(i,,n){
cnt += (ll)a[i]-(ll)(i-);
}
if(cnt&)cout<<"sjfnb";
else cout<<"cslnb";
return ;
}
Codeforces Round #573的更多相关文章
- Codeforces Round #573 (Div. 1) 差F
Codeforces Round #573 (Div. 1) E 题意:二维平面上有 n 个点,你可以放至多 m 条直线使得 (0,0) 与每个点的连线至少与一条直线相交.求原点与所有直线的距离最小值 ...
- Codeforces Round #573 (Div. 2) Tokitsukaze and Mahjong 水题
B. Tokitsukaze and Mahjong time limit per test1 second memory limit per test256 megabytes Tokitsukaz ...
- Codeforces Round #573 (Div. 1)
Preface 军训终于结束了回来补一补之前的坑发现很多题目题意都忘记了 这场感觉难度适中,F由于智力不够所以弃了,E的话石乐志看了官方英文题解才发现自己已经胡了一大半就差实现了233 水平下降严重. ...
- Codeforces Round 573 (Div.1) 题解
这场怎么说呢……有喜有悲吧. 开场先秒了 A.看到 B,感觉有点意思,WA 了 2 发后也过了. 此时还在 rk 前 200. 开 C,一看就不可做.跟榜,切 D 人数是 C 的两倍. 开 D.一眼感 ...
- Codeforces Round #573 (Div. 2) D. Tokitsukaze, CSL and Stone Game (博弈,思维)
D. Tokitsukaze, CSL and Stone Game time limit per test1 second memory limit per test256 megabytes in ...
- Codeforces Round #573 (Div. 2) E. Tokitsukaze and Duel (博弈)
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Codeforces Round #573 (Div. 2)
A:Tokitsukaze and Enhancement 当时看错条件了..以为A>C>B>D.就胡写了判断条件. #include<bits/stdc++.h> us ...
- Codeforces Round #573 (Div. 2) D题题解
一.题目 Tokitsukaze, CSL and Stone Game Tokitsukaze和CSL正在玩一些石头游戏. 一开始,有n堆的石头,第i堆石头数记为 \(a_i\),两人轮 ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
随机推荐
- 什么场景下用redis而不用mysql?
redis我们用作缓存,对查询速度要求比较高的应用场景比较适合.对有复杂逻辑关系的存储不适合. mysql是硬盘存储的,在高性能io要求的项目里不能满足需求,而redis所有数据存在内存里,因此要快得 ...
- intel RDT技术管理cache和memory_bandwidth
主页:https://www.intel.com/content/www/us/en/architecture-and-technology/resource-director-technology. ...
- 定时任务crond、crontab
crontab命令是用来设置定时任务规则的配置命令,配置文件/etc/crontab 与/var/spool/cron/目录下当前用户名的文件. -l 显示当前定时任务 -e 编辑定时任务 对于roo ...
- Educational Codeforces Round 55 (Rated for Div. 2) D. Maximum Diameter Graph (构造图)
D. Maximum Diameter Graph time limit per test2 seconds memory limit per test256 megabytes inputstand ...
- 长沙理工大学第十二届ACM大赛-重现赛I 主持人的烦恼 (sort)
链接:https://ac.nowcoder.com/acm/contest/1/I 来源:牛客网 主持人的烦恼 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语 ...
- VMware使用自带工具vmware-vdiskmanager精简占用磁盘空间
https://blog.csdn.net/xcl113/article/details/50715943 vmware-vdiskmanager压缩磁盘大小,验证有效 一 .sudo apt-get ...
- ubuntu(linux)如何安装nginx?
之前要在linux下面安装nginx,弄了半天,终于搞定了,下面给大家详细一下安装流程及安装报错解决方案: 安装共分为5步搞定: 1.进入src目录(下载存放目录) cd /usr/loca ...
- 基本数据类型、包装类、String类型之间的相互转换
@Testpublic void test2(){//基本数据类型.包装类-->到String类型的转换,调用String类型的静态方法valueOf()即可int i1 = 12;String ...
- Vue-搭建环境
项目开发完react-native,因为又对vue开始感兴趣了,又开始自学起了vue,关于vue是一个很简便的前端框架,要学习它,当然是要先学会搭建vue的环境, 不会搭建环境的程序员不是一个好的程序 ...
- Java动手动脑02
一.平方数静方法: public class SquareInt { public static void main(String[] args) { int result; for (int x = ...