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. android 权限动态申请

    名字其实有点让人感觉高大上"权限动态申请",其实也没有什么, 以前做Android程序的时候,比如需要打开摄像头 那么需要在 然后就可以了, 但是Android6.0之后呢,有些权 ...

  2. day90

    Vue项目简介 最终效果:Vue通过axios发请求给Django后台,Django返回数据给Vue 创建项目: 创建vue项目: -安装node.js -vue脚手架 -vue create 项目名 ...

  3. you-get帮助使用手册

    you-get使用手册 可选参数:   -V, --version          查看版本并退出   -h, --help             查看帮助信息 不影响使用的选项:   -i, - ...

  4. [Spark][Python]Wordcount 例子

    [training@localhost ~]$ hdfs dfs -cat cats.txt The cat on the matThe aardvark sat on the sofa[traini ...

  5. Flask-sqlalchemy 语法总结

    Flask-sqlalchemy 语法总结 ** DDLdb.create_all() :创建实体表db.drop_all(): 删除表 1)插入表Db.session.add(user) #user ...

  6. if...else 小练习

    # 需求:猜年龄,可以让用户最多猜三次 age = 60 for i in range(3): guess = int(input("Input Age: ")) if guess ...

  7. LVS+Keepalived 高可用环境部署记录(主主和主从模式)

    之前的文章介绍了LVS负载均衡-基础知识梳理, 下面记录下LVS+Keepalived高可用环境部署梳理(主主和主从模式)的操作流程: 一.LVS+Keepalived主从热备的高可用环境部署 1)环 ...

  8. ACM-ICPC 2017 Asia Urumqi:A. Coins(DP)

    挺不错的概率DP,看似基础,实则很考验扎实的功底 这题很明显是个DP,为什么???找规律或者算组合数这种概率,N不可能给的这么友善... 因为DP一般都要在支持N^2操作嘛. 稍微理解一下,这DP[i ...

  9. 四则运算C语言程序

    #include<stdio.h> #include<Windows.h> #include<time.h> void main() { int a, b, c, ...

  10. 【CV】ICCV2015_Unsupervised Visual Representation Learning by Context Prediction

    Unsupervised Visual Representation Learning by Context Prediction Note here: it's a learning note on ...