Educational Codeforces Round 68 (Rated for Div. 2) A B C

ARemove a Progression

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+100;

int main(){
	int t;
	cin >> t;
	while(t--){
		ll n , x;
		cin >> n >>x;
		cout << 2ll * x << "\n";
	}
	return 0;
}

  

BYet Another Crosses Problem

特判行列相交的点

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+100;

int q;
int n,m;
int d1[N];
int d2[N];
int main(){
	cin >> q;
	while(q--){
		cin >> n >> m;
		int a[n+10][m+10];
		for(int i=0;i<n;i++)
			d1[i]=0;
		for(int i=0;i<m;i++){
			d2[i]=0;
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				char c;
				cin >> c;
				if(c=='*') {
					a[i][j]=1;
					d1[i]++,d2[j]++;
				}
				else a[i][j]=0;
			}
		}
		int m1=n*m;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(a[i][j]==0){
					m1=min(m1,n+m-1-d1[i]-d2[j]);
				}
				else{
					m1=min(m1,n+m-d1[i]-d2[j]);
				}
			}
		}
		cout << m1 << "\n";
	}
	return 0;
}

  

CFrom S To T

s长度需要小于t,s串顺序在t串中必须存在,s串和p串每个字母的数量之和要大于t串。

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+100;

int q;
char s[3][200];
int a[3][26];
int main(){
	cin >> q;
	while(q--){
		for(int i=0;i<3;i++){
			cin >> s[i];
			for(int j=0;j<26;j++){
				a[i][j]=0;
			}
		}
		int l1=strlen(s[0]),l2=strlen(s[1]);
		if(l1>l2){
			cout << "NO\n";
			continue;
		}
		int i1=0,i2=0;
		for( i2=0;i2<l2;i2++){
			if(s[0][i1]==s[1][i2]){
				i1++;
				if(i1==l1) break;
			}
		}
		if(i1!=l1) {
			cout << "NO\n";
			continue;
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<strlen(s[i]);j++){
				a[i][s[i][j]-'a']++;
			}
		}
		bool flag=0;
		for(int i=0;i<26;i++){
			if(a[0][i]+a[2][i]<a[1][i] || a[0][i]>a[1][i]){
				cout << "NO\n";
				flag=1;
				break;
			}
		}
		if(flag) continue;
		cout << "YES\n";
	}
	return 0;
}

  

posted @ 2019-07-15 18:58  Pikachu_Yj  阅读(101)  评论(0编辑  收藏  举报