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的更多相关文章

  1. Codeforces Round #573 (Div. 1) 差F

    Codeforces Round #573 (Div. 1) E 题意:二维平面上有 n 个点,你可以放至多 m 条直线使得 (0,0) 与每个点的连线至少与一条直线相交.求原点与所有直线的距离最小值 ...

  2. Codeforces Round #573 (Div. 2) Tokitsukaze and Mahjong 水题

    B. Tokitsukaze and Mahjong time limit per test1 second memory limit per test256 megabytes Tokitsukaz ...

  3. Codeforces Round #573 (Div. 1)

    Preface 军训终于结束了回来补一补之前的坑发现很多题目题意都忘记了 这场感觉难度适中,F由于智力不够所以弃了,E的话石乐志看了官方英文题解才发现自己已经胡了一大半就差实现了233 水平下降严重. ...

  4. Codeforces Round 573 (Div.1) 题解

    这场怎么说呢……有喜有悲吧. 开场先秒了 A.看到 B,感觉有点意思,WA 了 2 发后也过了. 此时还在 rk 前 200. 开 C,一看就不可做.跟榜,切 D 人数是 C 的两倍. 开 D.一眼感 ...

  5. 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 ...

  6. Codeforces Round #573 (Div. 2) E. Tokitsukaze and Duel (博弈)

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  7. Codeforces Round #573 (Div. 2)

    A:Tokitsukaze and Enhancement 当时看错条件了..以为A>C>B>D.就胡写了判断条件. #include<bits/stdc++.h> us ...

  8. Codeforces Round #573 (Div. 2) D题题解

    一.题目 ​ Tokitsukaze, CSL and Stone Game ​ Tokitsukaze和CSL正在玩一些石头游戏. ​ 一开始,有n堆的石头,第i堆石头数记为 \(a_i\),两人轮 ...

  9. 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 ...

随机推荐

  1. React事件绑定的几种方式对比

    React事件绑定 由于类的方法默认不会绑定this,因此在调用的时候如果忘记绑定,this的值将会是undefined.通常如果不是直接调用,应该为方法绑定this.绑定方式有以下几种: 1. 在构 ...

  2. 计算机系统结构总结_Instruction Set Architecture

    Textbook:<计算机组成与设计——硬件/软件接口>  HI<计算机体系结构——量化研究方法>          QR 这节我们来看CPU内部的一些东西. Instruct ...

  3. sqlserver 创建 aspstate的方法

    找到路径 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 不同版本找不同版本的路径 在命令行执行命令 aspnet_regsql.exe -ssadd -s ...

  4. 初学ctypes:打开进程并返回相关信息

    直接上代码: 1. my_debugger_defines.py 定义相关结构体(在后面创建进程及返回信息时,传参可用到) from ctypes import * # Let's map the M ...

  5. 用HTTP核心模块配置一个静态Web服务器

    静态Web服务器的主要功能由ngx_http_core_module模块(HTTP框架的主要成员)实现与core模块类似,可以根据相关模块(如ngx_http_gzip_filter_module.n ...

  6. STM32F407 正点原子按键输入实验

    库函数版本: 库函数 源文件 头文件 GPIO_Init(GPIOE, &GPIOE_initstructure) stm32f4xx_gpio.c stm32f4xx_gpio.h RCC_ ...

  7. 【转】/etc/inittab文件详解

    转自:https://www.cnblogs.com/ricks/p/10020886.html Linux在完成核内引导(已经被载入内存,开始运行,并已初始化所有的设备驱动程序和数据结构等)之后,就 ...

  8. NNIE(待尝试)

    马克 https://blog.csdn.net/ywcpig/article/details/85260752 https://blog.csdn.net/u011728480/article/de ...

  9. STM32CubeMX FreeRTOS no definition for "osThreadGetState" 解决办法

    用STM32CubuMX默认加入的FreeRTOS默认配置eTaskGetState是禁止的 把该功能设为Enabled编译就不会出错了 IAR的编译器要勾选Allow VLA

  10. 【bzoj2002】弹飞绵羊

    题目 某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏.游戏一开始,Lostmonkey在地上沿着一条直线摆上n个装置,每个装置设定初始弹力系数k ...