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 ...
随机推荐
- AXI总线协议
AXI总线协议 (一).概述 AXI (高性能扩展总线接口,Advanced eXtensible Interface)是ARM AMBA 单片机总线系列中的一个协议,是计划用于高性能.高主频的系统设 ...
- JS事件流、事件监听、事件对象、事件委托
JS事件流: 01.DOM级别和DOM事件 02.JS事件流:页面中接收事件的顺序 事件冒泡阶段-->处于目标阶段-->事件捕获阶段 (事件捕获总发生在事件冒泡前面) 03.捕获:从外向里 ...
- 出去就餐并且理解Express.js的基本知识
Going out to eat and understanding the basics of Express.js出去就餐并且理解Express.js的基本知识 原文:Going out to e ...
- 图解Qt安装(Linux平台)
http://c.biancheng.net/view/3886.html Linux 发行版虽然众多,但 Qt 安装过程大同小异,本节以 CentOS 7 为例来演示 Qt 的安装. 在<Qt ...
- 判断是否是iframe框架打开登录页, iframe框架着顶部页面刷新
if (window != top) top.location.href = location.href;
- get请求和post请求参数中文乱码的解决办法
get请求参数中文乱码的解决办法 在tomcat的server.xml里的Connector加个URIEncoding="UTF-8",把 <Connector connec ...
- 搭建DHCP服务实现动态分配IP地址-NTP网络时间同步
本节所讲内容: DHCP服务器工作原理 使用DHCP为局域网中的机器分配IP地址 使用DHCP为服务器分配固定IP地址 ntpdate加计划任务同步服务器时间 实验环境: 服务端:xuegod63 ...
- JS实现网页飘窗
1.在html中设置一个飘窗的div,div中可以添加图片,添加文字通过css展现在飘窗中: <!--飘窗--> <div id="roll"> <i ...
- 开发框架DevExtreme全新发布v19.1.3|附下载
DevExtreme Complete Subscription是性能最优的 HTML5,CSS 和 JavaScript 移动.Web开发框架,可以直接在Visual Studio集成开发环境,构建 ...
- Mybatis入门教程之新增、更新、删除功能_java - JAVA
文章来源:嗨学网 敏而好学论坛www.piaodoo.com 欢迎大家相互学习 上一节说了Mybatis的框架搭建和简单查询,这次我们来说一说用Mybatis进行基本的增删改操作: 一. 插入一条数据 ...