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 ...
随机推荐
- 剑指offer-二叉搜索树与双向链表-python
题目描述 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表.要求不能创建任何新的结点,只能调整树中结点指针的指向.. # -*- coding:utf-8 -*- # class TreeN ...
- 出去就餐并且理解Express.js的基本知识
Going out to eat and understanding the basics of Express.js出去就餐并且理解Express.js的基本知识 原文:Going out to e ...
- python小实例
一.跳动的心 love = '\n'.join([''.join([('love'[(x-y) % len('Love')] if ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0 ...
- Centos修改默认运行级别
一.centos默认运行级别 下面是linux的默认运行级别.vim /etc/inittab即可查看. # Default runlevel. The runlevels used are: # - ...
- PHP程序员要看的书单
想提升自己,还得多看书!多看书!多看书! 下面是我收集到的一些PHP程序员应该看得书单及在线教程,自己也没有全部看完.共勉吧! Github地址:https://github.com/52fhy/ph ...
- 前端每日实战:122# 视频演示如何用纯 CSS 创作一个苹果系统的相册图标
效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/zJKwbO 可交互视频 此视频是可 ...
- VMmare下安装redhat
一.虚拟机必须安装在自定义的文件夹下,虚拟硬盘文件必须存放在自定义路径下(避免中文) 二.安装时选择linux类型时必须选择red hat enterprise linux 5 64位 三.操作系统名 ...
- SpringBoot使用Easypoi导出excel示例
SpringBoot使用Easypoi导出excel示例 https://blog.csdn.net/justry_deng/article/details/84842111
- SpringToolSuit(STS)添加了Lombok后仍然报错
参见这篇博客 https://blog.csdn.net/qq_27442469/article/details/90612918 上面步骤做完后,在项目右键->Maven->Update ...
- wepy-数据双向绑定input
初入wepy,发现wepy和vue神似,但还是有不一样的地方,例如v-model数据双向绑定 场景: 一个input搜索框,用户输入内容,点击“叉叉”按钮,输入的内容全部清空,这是一个很常见的场景 j ...