codeforces educational round25

A

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,num=0;
    string s;
    cin>>n;
    cin>>s;
    for(int i=0;i<n;i++){
        if(s[i]!=‘0‘) num++;
        if(s[i]==‘0‘){ cout<<num;num=0;}
    }
    cout<<num;
    return 0;
}

B

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
string ss[100];
int main(){
    for(int i=0;i<10;i++){
        cin>>ss[i];
    }
    for(int i=0;i<10;i++){
        for(int j=0;j<6;j++){
            int num=0;
            bool flag=false;
            for(int k=0;k<5;k++){
                if(ss[i][j+k]==‘X‘) num++;
                if(ss[i][j+k]==‘O‘) flag=true;
            }
            if(num==4&&flag==false){
                cout<<"YES\n";
                return 0;
            }
            if(i<6){
            num=0;
            flag=false;
            for(int k=0;k<5;k++){
                if(ss[i+k][j+k]==‘X‘) num++;
                if(ss[i+k][j+k]==‘O‘) flag=true;
            }
            if(num==4&&flag==false){
                cout<<"YES\n";
                return 0;
            }
                num=0;
                flag=false;
                for(int k=0;k<5;k++){
                    if(ss[i+k][j]==‘X‘) num++;
                    if(ss[i+k][j]==‘O‘) flag=true;
                }
                if(num==4&&flag==false){
                    cout<<"YES\n";
                    return 0;
                }
            }
            if(i>=4){
                num=0;
                flag=false;
                for(int k=0;k<5;k++){
                    if(ss[i-k][j+k]==‘X‘) num++;
                    if(ss[i-k][j+k]==‘O‘) flag=true;
                }
                if(num==4&&flag==false){
                    cout<<"YES\n";
                    return 0;
                }
            }
        }
    }
    for(int i=0;i<10;i++){
        for(int j=6;j<10;j++){
            int num=0,flag=false;
            for(int k=0;k<5;k++){
                if(ss[i+k][j]==‘X‘) num++;
                if(ss[i+k][j]==‘O‘) flag=true;
            }
            if(num==4&&flag==false){
                cout<<"YES\n";
                return 0;
            }
        }
    }
    cout<<"NO\n";
    return 0;

}

C待更

时间: 2024-10-04 08:57:08

codeforces educational round25的相关文章

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://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w

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 input output standard output You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line

codeforces Educational Codeforces Round 5 A. Comparing Two Long Integers

题目链接:http://codeforces.com/problemset/problem/616/A 题目意思:顾名思义,就是比较两个长度不超过 1e6 的字符串的大小 模拟即可.提供两个版本,数组版本 & 指针版本. (1)数组版本(短的字符串从高位处补0,直到跟长的字符串长度相同) 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring>

(最小生成树)Codeforces Educational Codeforces Round 9 Magic Matrix

You're given a matrix A of size n?×?n. Let's call the matrix with nonnegative elements magic if it is symmetric (so aij?=?aji), aii?=?0 and aij?≤?max(aik,?ajk) for all triples i,?j,?k. Note that i,?j,?k do not need to be distinct. Determine if the ma

(KMP、dp)Codeforces Educational Codeforces Round 21 G-Anthem of Berland

Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem. Though there are lots and lots of victories in history of Berland, there is the one that stand out the most.

codeforces Educational Codeforces Round 2 C Make Palindrome

C. Make Palindrome A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings &quo

Codeforces Educational Round 23

A emmmmmmmmm B emmmmmmmmm C(套路) 题意: 给定n和s(n,s<=1e18),计算n以内有多少个数x满足(x-x的各个位置数字之和)>=s 分析: 容易想到如果x相对于s很大很大,那么肯定是满足条件的 那些小于s的数,肯定是不行的 于是x就可以从s开始,往后枚举1e6个,去判定这1e6个有多少个是满足条件的,再往后的那些x肯定是满足的,直接算出多少个就行了 D(插板法) 题意: 给定一个长度为n(n<=1e6)的数列,对于这个数列的一个连续的子列,定义valu

[Codeforces]Educational Codeforces Round 37 (Rated for Div. 2)

Water The Garden #pragma comment(linker, "/STACK:102400000,102400000") #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> #include<iostream> #include<map> #inclu

codeforces Educational Codeforces Round 9 E - Thief in a Shop

E - Thief in a Shop 题目大意:给你n ( n <= 1000)个物品每个物品的价值为ai (ai <= 1000),你只能恰好取k个物品,问你能组成哪些价值. 思路:我们很容易能够想到dp[ i ][ j ]表示取i次j是否存在,但是复杂度1e12肯定不行. 我们将ai排序,每个值都减去a[1]然后再用dp[ i ]表示到达i这个值最少需要取几次,只需要1e9就能完成, 我们扫一遍dp数组,如果dp[ i ]  <= k 则说明 i + k * a[1]是能取到的.