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 ...
随机推荐
- GIT笔记:将项目发布到GITHUB
GIT笔记:将项目发布到GITHUB 本机配置 1.在项目目录初始化GIT $ git init 2.用命令git add告诉Git,把文件添加到仓库 $ git add . // 这里是所有文件,用 ...
- linux 软件包的命名规则
linux软件包的命名规则 eg:主包 bind-9.7.1-1.el7.i586.rpm 子包 bind-libs-9.7.1-1.el7.i586.rpm bind-utils-9. ...
- Angular-ui-router路由,View管理
ui-router的工作原理非常类似于Angular的路由控制,他只关注状态. Angular模板 最简单的模板,例如main.html: <body data-ng-app="myA ...
- HTML5调用百度地图API进行地理定位实例
自从HTML5的标准确定以后,越来越多的网站使用HTML5来进行开发.虽然对HTML5支持的浏览器不是很多,但是依然抵挡不了大伙对HTML5开发的热情.今天为大家带来的是使用HTML5调用百度地图AP ...
- Tomcat启动分析(我们为什么要配置CATALINA_HOME环境变量)
原文:http://www.cnblogs.com/heshan664754022/archive/2013/03/27/2984357.html Tomcat启动分析(我们为什么要配置CATALIN ...
- ajax stream 一边下载二进制数据一边处理
最近有在做 stream 下载,并且边下载 stream 边处理功能.解析二进制的功能.最初参考了 flv.js 的 flv stream 下载处理功能,发现他并没有使用的 XMLHttpReques ...
- [Codeforces 204E] Little Elephant and Strings
[题目链接] https://codeforces.com/contest/204/problem/E [算法] 首先构建广义后缀自动机 对于自动机上的每个节点 , 维护一棵平衡树存储所有它所匹配的字 ...
- 如何查看Python 安装位置以及已经安装的库
如何查看Python 安装位置以及已经安装的库 步骤一: 1. Start 一个command prompt 2. 找到电脑中已经安装的Python 位置: where python 1 打开路径, ...
- Anthem.NET的 "Bad Response" 问题,及脚本调试技巧小结
今天解决了一位朋友使用 Anthem.NET 遇到的问题.他的代码在 Windows XP 的开发机器上反应正常,而部署到 2003 Server 的服务器上就提示 "BADRESPONSE ...
- JS之事件监听
一 如果事件监听类似于如下写法,则最终只会执行最后一个事件监听,其他监听都会被覆盖掉. window.onload=funtion(){console.log(1);}; window.onload= ...