Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A B题
当时晚上打CF时候比较晚,加上是集训期间的室友都没有晚上刷题的习惯,感觉这场CF很不在状态.A题写复杂WA了一发后去厕所洗了个脸冷静了下,换个简单写法,可是用cin加了ios::sync_with_stdio(false)还是WA了,真无语.B题读半天题,读懂后轻松A了,看了下比赛时间就快结束了,把C题读了一遍后,感觉能做,最后还是选择了睡觉23333..................
A题大意:
平平平 增平减 ,缺任一都可,判断是否为这样的数列
#include<stdio.h>
#include<cmath>
#include<string.h>
#include<iostream>
#include<algorithm>
#define INF 0x3f3f3f3f
using namespace std;
#define maxn 1005
#define inf 0x3f3f3f3f
int main()
{
int n,a[maxn];
while(~scanf("%d",&n))
{
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
a[n+1]=inf;
int p=2;
while(a[p]>a[p-1]) p++;
while(a[p]==a[p-1]) p++;
while(a[p]<a[p-1]) p++;
if(p>n) printf("YES\n");
else printf("NO\n");
}
return 0;
}
B题大意:
就是题目意思不好理解而已QAQ
给出三个字符串,其中第一和第二字符串长度都为26,在第三个字符串每个字符
若在第一个字符串找到相同的英文字母,则将第二个字符串中对应的英文字母打
印(注意大小写即可),若无对应,则将直接打印TwT
#include<stdio.h>
#include<cmath>
#include<cstring>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#define INF 0x3f3f3f3f
using namespace std;
#define maxn 1005
char a[maxn],b[maxn],c[maxn];
int main()
{
while(~scanf("%s%s%s",a,b,c))
{
int len1=strlen(a),len2=strlen(c),p;
for(int i=0;i<len2;i++)
{
if(c[i]>='a'&&c[i]<='z')
{
for(int j=0;j<len1;j++)
if(a[j]==c[i]) {p=j;break;}
printf("%c",b[p]);
}
else if(c[i]>='A'&&c[i]<='Z')
{
for(int j=0;j<len1;j++)
if(a[j]==c[i]+32) {p=j;break;}
printf("%c",b[p]-32);
}
else printf("%c",c[i]);
}
printf("\n");
}
return 0;
}
Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A B题的更多相关文章
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)
http://codeforces.com/contest/831 A. Unimodal Array time limit per test 1 second memory limit per te ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem C (Codeforces 831C) - 暴力 - 二分法
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A,B,C
A:链接:http://codeforces.com/contest/831/problem/A 解题思路: 从前往后分别统计递增,相等,递减序列的长度,如果最后长度和原序列长度相等那么就输出yes: ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem F (Codeforces 831F) - 数论 - 暴力
题目传送门 传送门I 传送门II 传送门III 题目大意 求一个满足$d\sum_{i = 1}^{n} \left \lceil \frac{a_i}{d} \right \rceil - \sum ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 831D) - 贪心 - 二分答案 - 动态规划
There are n people and k keys on a straight line. Every person wants to get to the office which is l ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem E (Codeforces 831E) - 线段树 - 树状数组
Vasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this int ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem A - B
Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is cons ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) A 水 B stl C stl D 暴力 E 树状数组
A. Unimodal Array time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - D
题目链接:http://codeforces.com/contest/831/problem/D 题意:在一个一维坐标里,有n个人,k把钥匙(钥匙出现的位置不会重复并且对应位置只有一把钥匙),和一个终 ...
随机推荐
- Apache许可翻译
https://www.apache.org/licenses/LICENSE-2.0 Apache许可 2.0 2004.1 使用.复制和发行的术语和条件. 1 定义 "License&q ...
- iOS 开发之 protocol Buffer 数据交换
前言: 从 14 年公司做项目时开始接触 Google 的 protocol Buffer,用了一段时间,后来到新公司就没有机会再使用了,趁着还没完全忘记,记录下. 简介:protocolbuffer ...
- nested exception is java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.
无法将"0000-00-00 00:00:00"转换为TIMESTAMP 2017-05-08 00:56:59 [ERROR] - cn.kee.core.dao.impl.Ge ...
- PHP初体验
PHP初体验 提笔写初体验总不知道从何说起,直接聊PHP中的函数.PHP网络技术.数据库操作.PHP模板等感觉又不是初体验.最后还是决定从PHP的面向对象.PHP的魔术方法.PHP的反射.PHP中的异 ...
- XOR 加密简介
本文介绍一种简单高效.非常安全的加密方法:XOR 加密. 一. XOR 运算 逻辑运算之中,除了 AND 和 OR,还有一种 XOR 运算,中文称为"异或运算". 它的定义是:两个 ...
- Docker化tomcat 并且使用maven热部署
今天没事干 就把自己的tomcat docker化并且使用maven实现热部署 特别记录一下~ 1.首先进行centos7的安装 就不在记录了 注意的是最好使用centos7 因为docker 依赖 ...
- 保存和恢复 Android Fragment 的状态
经过几年在 Android 应用开发中应用 Fragment 的努力之后,我必须要说尽管Fragment的概念非常优秀,但是它也同时带来了一堆问题.当我们处理实例的状态保存时就需要特别一件一件地修护好 ...
- 软件raid 5
软件raid 5的实现 RAID 5 是一种存储性能.数据安全和存储成本兼顾的存储解决方案. RAID 5可以理解为是RAID 0和RAID 1的折中方案.RAID 5可以为系统提供数据安全保障,但保 ...
- debian将默认中文改成英文
$ sudo export LANG=en_US.UTF-8 $ sudo dpkg-reconfigure locales
- getElementById和querySelector方法的区别
"querySelector 属于 W3C 中的 Selectors API 规范 .而 getElementsBy 系列则属于 W3C 的 DOM 规范" 1.区别 getXXX ...