codeforces educational round25
A
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int n,num=;
string s;
cin>>n;
cin>>s;
for(int i=;i<n;i++){
if(s[i]!='') num++;
if(s[i]==''){ cout<<num;num=;}
}
cout<<num;
return ;
}
B
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
string ss[];
int main(){
for(int i=;i<;i++){
cin>>ss[i];
}
for(int i=;i<;i++){
for(int j=;j<;j++){
int num=;
bool flag=false;
for(int k=;k<;k++){
if(ss[i][j+k]=='X') num++;
if(ss[i][j+k]=='O') flag=true;
}
if(num==&&flag==false){
cout<<"YES\n";
return ;
}
if(i<){
num=;
flag=false;
for(int k=;k<;k++){
if(ss[i+k][j+k]=='X') num++;
if(ss[i+k][j+k]=='O') flag=true;
}
if(num==&&flag==false){
cout<<"YES\n";
return ;
}
num=;
flag=false;
for(int k=;k<;k++){
if(ss[i+k][j]=='X') num++;
if(ss[i+k][j]=='O') flag=true;
}
if(num==&&flag==false){
cout<<"YES\n";
return ;
}
}
if(i>=){
num=;
flag=false;
for(int k=;k<;k++){
if(ss[i-k][j+k]=='X') num++;
if(ss[i-k][j+k]=='O') flag=true;
}
if(num==&&flag==false){
cout<<"YES\n";
return ;
}
}
}
}
for(int i=;i<;i++){
for(int j=;j<;j++){
int num=,flag=false;
for(int k=;k<;k++){
if(ss[i+k][j]=='X') num++;
if(ss[i+k][j]=='O') flag=true;
}
if(num==&&flag==false){
cout<<"YES\n";
return ;
}
}
}
cout<<"NO\n";
return ; }
C
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[];
int main(){
int n,k,num=,temp;
cin>>n>>k;
temp=*k;
for(int i=;i<n;i++) cin>>a[i];
sort(a,a+n);
for(int i=;i<n;i++){
if(a[i]>temp){
while(temp<a[i]){
num++;
temp*=;
}
}
temp=max(temp,*a[i]);
}
cout<<num<<endl;
}
D
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[],ss[];
int main(){
string s,t;
cin>>s>>t;
int k=;
for(int i=;i<s.size();i++){
if(s[i]=='?') ss[k++]=i;
else a[s[i]-'a']++;
}
for(int i=;i<k;){
for(int j=;j<t.size();j++){
if(a[t[j]-'a']>) a[t[j]-'a']--;//复杂度只有O(k+n)不是n*m
else{
s[ss[i]]=t[j];
i++;
if(i==k) break;
}
}
}
cout<<s; }
待更
codeforces educational round25的更多相关文章
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
- Codeforces Educational Round 33 题解
题目链接 Codeforces Educational Round 33 Problem A 按照题目模拟,中间发现不对就直接输出NO. #include <bits/stdc++.h> ...
- Codeforces Educational Round 92 赛后解题报告(A-G)
Codeforces Educational Round 92 赛后解题报告 惨 huayucaiji 惨 A. LCM Problem 赛前:A题嘛,总归简单的咯 赛后:A题这种**题居然想了20m ...
- codeforces Educational Codeforces Round 5 A. Comparing Two Long Integers
题目链接:http://codeforces.com/problemset/problem/616/A 题目意思:顾名思义,就是比较两个长度不超过 1e6 的字符串的大小 模拟即可.提供两个版本,数组 ...
- codeforces Educational Codeforces Round 16-E(DP)
题目链接:http://codeforces.com/contest/710/problem/E 题意:开始文本为空,可以选择话费时间x输入或删除一个字符,也可以选择复制并粘贴一串字符(即长度变为两倍 ...
- Codeforces Educational Codeforces Round 15 E - Analysis of Pathes in Functional Graph
E. Analysis of Pathes in Functional Graph time limit per test 2 seconds memory limit per test 512 me ...
- Codeforces Educational Codeforces Round 15 D. Road to Post Office
D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standa ...
- Codeforces Educational Codeforces Round 15 C. Cellular Network
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
随机推荐
- Android Theme主题
•android:theme="@android:style/Theme.Dialog" 将一个Activity显示为能话框模式 •android:theme="@and ...
- java程序实现Unicode码和中文互相转换
根据前一篇的补充问题http://blog.csdn.net/fancylovejava/article/details/10142391 有了前一篇文章的了解,大概了解了unicode编码格式了 ...
- echo 命令参数
echo 命令参数: -n 不换行输出 -e 解析转义字符(\n \t \b \r)
- poj 1028 Web Navigation 【模拟题】
题目地址:http://poj.org/problem?id=1028 测试样例: Sample Input VISIT http://acm.ashland.edu/ VISIT http://ac ...
- EntityFramework 学习 一 Update Entity Graph using DbContext:
使用主键属性 每个实体必须有主键 默认值的id属性值必须为0 在context2中,它不知道实体的状态, 只能通过实体的主键来判断实体的状态 如果主键为0,则是新的对象,不为0 就是修改 Standa ...
- 大话设计模式--装饰者模式 Decorator -- C++实现实例
1.装饰者模式 Decorator 动态地给一个对象添加一个额外的职责, 就添加功能来说, 装饰模式比生成子类更为灵活. 每个装饰对象的实现和如何使用这个对象分离, 每个装饰对象只关心自己的功能,不 ...
- matlab对点云旋转平移
1.显示茶壶点云 ptCloud = pcread('teapot.ply');figure(1)pcshow(ptCloud); title('Teapot'); 2.Create a transf ...
- eclipse快捷提示原理
eclipse快捷提示利用的是java反射,因为只有反射才能让eclipse知道类有哪些变量和方法.
- node.js+express+jade系列六:图片的上传
安装npm install formidable 先把文件上传到临时文件夹,再通过fs重命名移动到指定的目录即可 fs.rename即重命名,但是fs.rename不能夸磁盘移动文件,所以我们需要指定 ...
- 更新github上代码
前面一篇已经实现首次上传代码到github了,本篇继续讲如何把本地更新的代码同步更新到github上 一.clone代码 1.把大神的代码clone到本地,或者clone自己github上的代码,使用 ...