凉肝的比赛

#凉肝的比赛
##A - Mezo Playing Zoma
Today, Mezo is playing a game. Zoma, a character in that game, is initially at position x=0. Mezo starts sending n commands to Zoma. There are two possible commands:

‘L’ (Left) sets the position x:=x−1;
‘R’ (Right) sets the position x:=x+1.
Unfortunately, Mezo’s controller malfunctions sometimes. Some commands are sent successfully and some are ignored. If the command is ignored then the position x doesn’t change and Mezo simply proceeds to the next command.

For example, if Mezo sends commands “LRLR”, then here are some possible outcomes (underlined commands are sent successfully):

“LRLR” — Zoma moves to the left, to the right, to the left again and to the right for the final time, ending up at position 0;
“LRLR” — Zoma recieves no commands, doesn’t move at all and ends up at position 0 as well;
“LRLR” — Zoma moves to the left, then to the left again and ends up in position −2.
Mezo doesn’t know which commands will be sent successfully beforehand. Thus, he wants to know how many different positions may Zoma end up at.

Input
The first line contains n (1≤n≤105) — the number of commands Mezo sends.

The second line contains a string s of n commands, each either ‘L’ (Left) or ‘R’ (Right).

Output
Print one integer — the number of different positions Zoma may end up at.

Example
Input
4
LRLR
Output
5
Note
In the example, Zoma may end up anywhere between −2 and 2.
今天,Mezo在玩游戏。Zoma是游戏中的一个角色,最初的位置是x=0。Mezo开始向Zoma发送n个命令。有两个可能的命令:
“L”(左)设置位置x:=x−1;
“R”(右)设置位置x:=x+1
不幸的是,Mezo的控制器有时会出现故障。一些命令已成功发送,一些命令被忽略。如果忽略该命令,则位置x不会改变,Mezo将直接执行下一个命令。
例如,如果Mezo发送命令“LRLR”,则以下是一些可能的结果(带下划线的命令成功发送):
“LRLR”-Zoma最后一次向左、向右、向左和向右移动,最终到达位置0;
“LRLR”-Zoma不接收任何命令,完全不移动,最后也在位置0;
“LRLR”-Zoma向左移动,然后再次向左移动,最后到达位置-2。
Mezo事先不知道哪些命令会成功发送。因此,他想知道Zoma最终会有多少不同的位置。
输入
第一行包含n(1≤n≤105)-Mezo发送的命令数。
第二行包含n个命令的字符串s,每个命令要么是“L”(左)要么是“R”(右)。
输出
打印一个整数-Zoma可能会在不同的位置结束。
Example
Input
4
LRLR
Output
5
注意
在本例中,Zoma可能最终出现在-2到2之间的任何位置。

代码:
#include <stdio.h>
const int maxn=1e+5;
char a[maxn+10];
int main()
{
int n;
scanf("%d%s",&n,a);
printf("%d",n+1);
}

##E - Deadline

在这里插入图片描述
http://codeforces.com/problemset/problem/1288/A
代码:
#include <stdio.h>
#include <math.h>
int main()
{
int t;
scanf("%d",&t);
while(t–)
{
int n,d;
scanf("%d%d",&n,&d);
if(n>=d)
{
printf(“YES\n”);
}
else if(n==1&&d>1)
{
printf(“NO\n”);
}
else
{
double k=sqrt(d);
if(k-(int)k)
{
int n2=(int)k,m=n2+1,n1,m1,min;
if(!((d/(double)n2)-(d/n2)))
n1=n2+d/n2-1;
else
n1=n2+(d/n2);
if(!((d/(double)m)-(d/m)))
m1=m+d/m-1;
else
m1=m+(d/m);
if(n1>=m1)
min=m1;
else
min=n1;
if(min<=n)
printf(“YES\n”);
else
printf(“NO\n”);

		}
		else
		{
			int min=2*k-1;
				if(min<=n)
					printf("YES\n");
				else
					printf("NO\n");
		}
	}
}
return 0;

}
#G - HQ9+
HQ9+ is a joke programming language which has only four one-character instructions:

“H” prints “Hello, World!”,
“Q” prints the source code of the program itself,
“9” prints the lyrics of “99 Bottles of Beer” song,
“+” increments the value stored in the internal accumulator.
Instructions “H” and “Q” are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored.

You are given a program written in HQ9+. You have to figure out whether executing this program will produce any output.

Input
The input will consist of a single line p which will give a program in HQ9+. String p will contain between 1 and 100 characters, inclusive. ASCII-code of each character of p will be between 33 (exclamation mark) and 126 (tilde), inclusive.

Output
Output “YES”, if executing the program will produce any output, and “NO” otherwise.

Examples
Input
Hi!
Output
YES
Input
Codeforces
Output
NO
Note
In the first case the program contains only one instruction — “H”, which prints “Hello, World!”.

In the second case none of the program characters are language instructions.

HQ9+是一种笑话编程语言,只有四个一字符指令:
H打印“你好,世界!”,
“Q”打印程序本身的源代码,
“9”打印了“99瓶啤酒”的歌词,
“+”递增存储在内部累加器中的值。
指令“H”和“Q”区分大小写,必须大写。程序的非指令字符将被忽略。
给你一个用HQ9+编写的程序。你必须弄清楚执行这个程序是否会产生任何输出。
输入
输入将由一行p组成,p将给出一个HQ9+格式的程序。字符串p将包含1到100个字符(包括1到100个字符)。p的每个字符的ASCII代码将介于33(感叹号)和126(颚化符)之间(含)。
输出
如果执行程序将产生任何输出,则输出“是”,否则输出“否”。
Examples
Input
Hi!
Output
YES
Input
Codeforces
Output
NO
注意
在第一种情况下,程序只包含一条指令-“H”,它会打印“Hello,World!”.
在第二种情况下,程序字符都不是语言指令。

代码:
#include <stdio.h>
#include <string.h>
int main()
{
char a[1000];
scanf("%s",a);
int str=strlen(a);
int d=0;
for(int i=0;i<str;i++)
{
if(a[i]‘H’||a[i]‘Q’||a[i]‘9’)
{
printf(“YES”);
d=1;
break;
}
}
if(d
0)
printf(“NO”);
return 0;
}

源码地址: https://pan.quark.cn/s/d1f41682e390 miyoubiAuto 米游社每日米游币自动化Python脚本(务必使用Python3) 8更新:更换cookie的获取地址 注意:禁止在B站、贴吧、或各大论坛大肆传播! 作者已退游,项目不维护了。 如果有能力的可以pr修复。 小引波 推荐关注几个非常可爱有趣的女孩! 欢迎B站搜索: @嘉然今天吃什么 @向晚大魔王 @乃琳Queen @贝拉kira 第三方库 食用方法 下载源码 在Global.py中设置米游社Cookie 运行myb.py 本地第次运行时会自动生产个文件储存cookie,请勿删除 当前仅支持单个账号! 获取Cookie方法 浏览器无痕模式打开 http://user.mihoyo.com/ ,登录账号 按,打开,找到并点击 按刷新页面,按下图复制 Cookie: How to get mys cookie 当触发时,可尝试按关闭,然后再次刷新页面,最后复制 Cookie。 也可以使用另种方法: 复制代码 浏览器无痕模式打开 http://user.mihoyo.com/ ,登录账号 按,打开,找到并点击 控制台粘贴代码并运行,获得类似的输出信息 部分即为所需复制的 Cookie,点击确定复制 部署方法--腾讯云函数版(推荐! ) 下载项目源码和压缩包 进入项目文件夹打开命令行执行以下命令 xxxxxxx为通过上面方式或取得米游社cookie 定要用双引号包裹!! 例如: png 复制返回内容(包括括号) 例如: QQ截图20210505031552.png 登录腾讯云函数官网 选择函数服务-新建-自定义创建 函数名称随意-地区随意-运行环境Python3....
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值