A:链接:http://codeforces.com/contest/831/problem/A

解题思路:

从前往后分别统计递增,相等,递减序列的长度,如果最后长度和原序列长度相等那么就输出yes;

实现代码:

#include<bits/stdc++.h>
using namespace std; int main()
{
int m,i,ans=,a[];
cin>>m;
for(i=;i<m;i++){
cin>>a[i];
}
for(i=;i<m-;i++){
if(a[i]<a[i+])
ans++;
else
break;
}
//cout<<i<<endl;
for(;i<m-;i++){
if(a[i]==a[i+])
ans++;
else
break;
}
//cout<<i<<endl;
for(;i<m-;i++){
if(a[i]>a[i+])
ans++;
else
break;
}
//cout<<ans<<endl;
if(ans==m)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return ;
}

B:链接:http://codeforces.com/contest/831/problem/B

解题思路:

就是求第三个字符串中的字符在第一的序列的位置,输出第二个字符串当前位置的字符

实现代码:

#include<bits/stdc++.h>
using namespace std; int main()
{
string s1,s2,s3;
char c;
int i,j;
cin>>s1; cin>>s2; cin>>s3;
int len = s3.size();
for(i=;i<len;i++){
if(s3[i]>='A'&&s3[i]<='Z'){
c = tolower(s3[i]);
for(j=;j<s1.size();j++){
if((char)c==s1[j]){
cout<<(char)(s2[j]-);
break;}
}
}
else if(s3[i]>='a'&&s3[i]<='z'){
for(j=;j<s1.size();j++)
if(s3[i]==s1[j])
cout<<s2[j];
}
else
cout<<s3[i];
}
cout<<endl;
return ;
}

C:链接:http://codeforces.com/contest/831/problem/C

解题思路:

a[]表示评委给的分,b[]表示某个状态的分数

先前缀和处理一下a[i],由于初始分数可能由最小的b[]加上某一个a[i]表示,所以先设存在一个初值=b[1]-a[i],依次判断,如果这个初值能满足加上任意评委给的分,都能得到某状态的分数:x+a[i]=b[j] 可转化为: a[i] = b[j] - x;能满足的初值,存进集合里,最后输出数量即可

#include<bits/stdc++.h>
using namespace std;
set<int>st;
int main()
{
int m,n,a[],b[],i,j,temp,flag;
cin>>m>>n;
memset(a,,sizeof(a));
for(i=;i<=m;i++){
cin>>a[i];
a[i] += a[i-];
}
sort(a+,a+m+);
for(i=;i<=n;i++)
cin>>b[i];
sort(b+,b++n);
for(i=;i<=m;i++){
flag = ;int x = b[] - a[i];
for(j=;j <= n;j++){
temp = b[j] - x;
int ans = lower_bound(a+i,a++m,temp) - a;
if(ans>m||a[ans]!=temp){
flag = ;
break;
}
}
if(flag)
st.insert(a[i]);
}
cout<<(int)st.size()<<endl;
return ;
}

Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A,B,C的更多相关文章

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

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

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

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

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

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

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

  8. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - D

    题目链接:http://codeforces.com/contest/831/problem/D 题意:在一个一维坐标里,有n个人,k把钥匙(钥匙出现的位置不会重复并且对应位置只有一把钥匙),和一个终 ...

  9. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - C

    题目链接:http://codeforces.com/contest/831/problem/C 题意:给定k个评委,n个中间结果. 假设参赛者初始分数为x,按顺序累加这k个评委的给分后得到k个结果, ...

随机推荐

  1. [06] 利用mybatis-generator自动生成代码

    1.mybatis-generator 概述 MyBatis官方提供了逆向工程 mybatis-generator,可以针对数据库表自动生成MyBatis执行所需要的代码(如Mapper.java.M ...

  2. 人生苦短之HTTP协议及Requests库的方法

    requests库的主要方法:requests.request()构造一个请求    requests.get()获取HTML网页的主要方法,对应于HTTP的GET    requests.head( ...

  3. java算法----排序----(6)希尔排序(最小增量排序)

    package log; public class Test4 { /** * java算法---希尔排序(最小增量排序) * * @param args */ public static void ...

  4. vue 中使用iconfont Unicode编码线上字体图标的流程

    1.打开http://www.iconfont.cn官网,搜索你想要的图标.添加字体图标到购物车,点击购物车然后添加至项目,点击确定 2.点击图标管理/我的项目,找到对应的文件,点击Unicode,然 ...

  5. 使用sklearn进行K_Means聚类算法

    首先附上官网说明 [http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html#examples-usin ...

  6. LVM : 快照

    LVM 机制还提供了对 LV 做快照的功能,也就是说可以给文件系统做一个备份,这也是设计 LVM 快照的主要目的.LVM 的快照功能采用写时复制技术(Copy-On-Write,COW),这比传统的备 ...

  7. linux-IO重定向-文本流重定向

    输出重定向的追加和覆盖 标准输出就这两种: 覆盖和追加 >> 是重定向操作符 1 是 命令的文件描述符 重定向操作符合文件描述符之间不能存在空白符 否则1会被当做是文件被读取 将正确和错误 ...

  8. CF1016 D. Vasya And The Matrix

    传送门 [http://codeforces.com/group/1EzrFFyOc0/contest/1016/problem/D] 题意 已知矩阵n行m列,以及每一行,每一列所有元素的异或,用 a ...

  9. 跟踪分析Linux内核的启动过程

    潘俊洋 原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.准备 搭建环境 1 2 ...

  10. Opentsdb 启动显示配置文件不存在

    今天 重新启动opentsdb  出现本地配置文件不存在   这不知道  我查了一下官网 了解到 You can use the --config command line argument to s ...