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 ...
随机推荐
- 在Nginx中做负载均衡配置的实例讲解
负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法. 先来简单了解一下什么是负载均衡,单从字面上的意思来理解就可以解释N台服务器平均分担负载,不会因为某 ...
- [原创]java WEB学习笔记37:EL表达式(简介,运算符,自动类型转换,保留字,隐含对象)
1.EL 简介 1)EL 全名为 Expression Language,它原本是 JSTL 1.0 为方便存取数据所自定义的语言 2)语法:EL 语法很简单,它最大的特点就是使用上很方便:${s ...
- 【七】MongoDB管理之分片集群介绍
分片是横跨多台主机存储数据记录的过程,它是MongoDB针对日益增长的数据需求而采用的解决方案.随着数据的快速增长,单台服务器已经无法满足读写高吞吐量的需求.分片通过水平扩展的方式解决了这个问题.通过 ...
- Python 3 并发编程多进程之队列(推荐使用)
Python 3 并发编程多进程之队列(推荐使用) 进程彼此之间互相隔离,要实现进程间通信(IPC),multiprocessing模块支持两种形式:队列和管道,这两种方式都是使用消息传递的. 可以往 ...
- 处理 javax.el.ELException: Failed to parse the expression 报错
在JSP的表达式语言中,使用了 <h3>是否新Session:${pageContext.session.new}</h3> 输出Session是否是新的,此时遇到了 j ...
- UOJ279 【UTR #2】题目交流通道
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump ...
- MySQL- 常用的MySQL函数,指令等
MySQL查看版本: status: 或者 select version(); //select @@version MySQL昨天, 一周前 ,一月前 ,一年前的数据 这里主要用到了 DATE_SU ...
- DIV+CSS IE6/IE7/IE8/FF兼容问题大全
1. [代码][CSS]代码 1, FF下给 div 设置 padding 后会导致 width 和 height 增加, 但IE不会.(可用!important解决) 2, 居中问题. 1).垂直居 ...
- artdialog插件--iframe穿透特性
使用artdialog可以实现嵌套页面间的通信. 一.引入插件 //artdialog是建立在jquery上面的所以要首先引入jquery <script src="__CLASSTP ...
- 分享知识-快乐自己:初中级 java 面试题宝典
1):Jsp的重定向和转发的流程有什么区别 重定向是客户端行为,转发是服务器端行为 重定向时服务器产生两次请求,转发产生一次请求,重定向时可以转发到项目以外的任何网址,转发只能在当前项目里转发 重定向 ...