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 ...
随机推荐
- rails 常用方法
bundle install --without production 不安装production中的gem ./configure && make && sudo m ...
- ubuntu android studio 编译及运行错误Error retrieving parent for item: No resource found that matches the given name
安装好android studio并且安装其它需要的SDK或组件后,根据向导生成新的项目, 编译或运行时可能会出现下面的错误: Error:Error retrieving parent for it ...
- 《程序员代码面试指南》第五章 字符串问题 去掉字符串中连续出现k 个0 的子串
题目 去掉字符串中连续出现k 个0 的子串 java代码 package com.lizhouwei.chapter5; /** * @Description: 去掉字符串中连续出现k 个0 的子串 ...
- Docker 镜像篇
镜像是 Docker 容器的基石,容器是镜像的运行实例,有了镜像才能启动容器. docker两个跟镜像有关的命令: hello-world - 最小的镜像 hello-world 是 Docker 官 ...
- grunt小教程
本人的博客写了grunt的小教程,从零开始,一步一步的通过例子讲解,希望喜欢的同学给我的github上加颗星,谢谢! github地址: https://github.com/manlili/grun ...
- Charles进行HTTPS抓包(iOS为例)
各种抓包工具的原理都是一样的,使用方面也都是差不多的,因为最近在用Mac,所以抓包工具开始用Charles了,记录一下抓取HTTPS的步骤. 连接代理, 开启抓包工具, 手机设置代理服务器,端口号(默 ...
- 大话设计模式--职责连模式 Chain of Resposibility -- C++实现实例
1. 职责链模式: 使多个对象都有机会处理请求,从而避免请求发送者和接受者之间的耦合关系,将这个对象连成一条链,并沿着这条链传递该请求,直到有一个对象处理它. 当客户提交一个请求时,请求是沿着链传递直 ...
- IntelliJ IDEA Sringboot 项目部署到外部Tomcat服务器
<packaging>war</packaging> 添加依赖 <dependency> <groupId>org.springframework.bo ...
- C#--父子页面传值、刷新(showModalDialog)
父页面: var obj = new Object(); obj.name="name"; var rtnValue=window.showModalDialog("ch ...
- hdu 2018 母牛的故事(简单dp)
母牛的故事 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...