B. Flag of Berland

链接:http://codeforces.com/contest/837/problem/B

思路:题目要求判断三个字母是否是条纹型的,而且宽和高相同,那么先求出三个字母的边界,算下面积,是否和数量相同,不相同的话肯定不为条纹型,然后判断下他们宽和高的关系就行了

实现代码:

#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<list>
using namespace std;
#define ll long long
#define sd(x) scanf("%d",&x)
#define sdd(x,y) scanf("%d%d",&x,&y)
#define sddd(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sf(x) scanf("%s",x)
#define ff(i,x,y) for(int i = x;i <= y;i ++)
#define fj(i,x,y) for(int i = x;i >= y;i --)
#define mem(s,x) memset(s,x,sizeof(s));
#define pr(x) printf("%d",x);
const int Mod = 1e9+;
const int inf = 1e9;
const int Max = 1e5+;
//void exgcd(ll a,ll b,ll& d,ll& x,ll& y){if(!b){d=a;x=1;y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}
//ll inv(ll a,ll n){ll d, x, y;exgcd(a,n,d,x,y);return (x+n)%n;}
//int gcd(int a,int b) { return (b>0)?gcd(b,a%b):a; }
//int lcm(int a, int b) { return a*b/gcd(a, b); } int main()
{
int n,m,en_rx=,be_rx=inf,en_ry=,be_ry=inf,en_gx=,en_gy=,en_bx=,en_by=,be_gx=inf,be_gy=inf,be_bx=inf,be_by=inf,r,g,b;
char mp[][];
sdd(n,m);
r=;g=;b=;
ff(i,,n){
ff(j,,m){
cin>>mp[i][j];
if(mp[i][j]=='R'){
r++; en_rx = max(i,en_rx);en_ry = max(j,en_ry);be_rx=min(i,be_rx);be_ry=min(j,be_ry);}
if(mp[i][j]=='G'){ g++; en_gx = max(i,en_gx);en_gy = max(j,en_gy);be_gx=min(i,be_gx);be_gy=min(j,be_gy);}
if(mp[i][j]=='B'){ b++; en_bx = max(i,en_bx);en_by = max(j,en_by);be_bx=min(i,be_bx);be_by=min(j,be_by);}
}
}
if(n*m<){
cout<<"NO"<<endl;return ;}
int num = (en_rx - be_rx+)*(en_ry - be_ry+);
//cout<<num<<endl;
//cout<<en_gx<<" "<<be_gx<<endl;
//cout<<en_ry<<" "<<be_ry<<endl;
if((en_rx - be_rx)==(en_gx - be_gx)&&(en_gx - be_gx)==(en_bx - be_bx)&&(en_ry - be_ry)==(en_gy - be_gy)&&(en_gy - be_gy)==(en_by - be_by)&&num==r)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return ;
}

C. Two Seals

题目链接:http://codeforces.com/contest/837/problem/C

思路:

给你几个方块,让你选两个方块放在a*b范围里,要求面积最大,方块可以转90度,直接暴力模拟就是了

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll x[],y[];
int a,b;
ll max(ll x,ll y)
{
if(x>y) return x;
return y;
}
bool check(int i,int j){
ll a1=x[i]+x[j],b1=max(y[i],y[j]);
ll a2=y[i]+x[j],b2=max(x[i],y[j]);
ll a3=x[i]+y[j],b3=max(y[i],x[j]);
ll a4=y[i]+y[j],b4=max(x[i],x[j]);
if((a1<=a && b1<=b) || (a2<=a && b2<=b) || (a3<=a && b3<=b) || (a4<=a && b4<=b))
return true;
if((a1<=b && b1<=a) || (a2<=b && b2<=a) || (a3<=b && b3<=a) || (a4<=b && b4<=a))
return true;
return false;
}
int main()
{
int n,c=,y1,x1,i,j;
cin>>n>>a>>b;
for(i=;i<n;i++)
cin>>x[i]>>y[i];
ll ans = ,maxx = ;
for(i=;i<n-;i++){
for(j=i+;j<n;j++){
if(check(i,j)==){
ans = x[i]*y[i]+x[j]*y[j];
//cout<<i<<" "<<j<<" "<<ans<<endl;
maxx = max(maxx,ans);
}
}
}
cout<<maxx<<endl;
return ;
}

ps:好鸡儿菜啊,打了一年还是这么水。

Educational Codeforces Round 26 B,C的更多相关文章

  1. Educational Codeforces Round 26

    Educational Codeforces Round 26 困到不行的场,等着中午显示器到了就可以美滋滋了 A. Text Volume time limit per test 1 second ...

  2. CodeForces 837F - Prefix Sums | Educational Codeforces Round 26

    按tutorial打的我血崩,死活挂第四组- - 思路来自FXXL /* CodeForces 837F - Prefix Sums [ 二分,组合数 ] | Educational Codeforc ...

  3. CodeForces - 837E - Vasya's Function | Educational Codeforces Round 26

    /* CodeForces - 837E - Vasya's Function [ 数论 ] | Educational Codeforces Round 26 题意: f(a, 0) = 0; f( ...

  4. CodeForces 837D - Round Subset | Educational Codeforces Round 26

    /* CodeForces 837D - Round Subset [ DP ] | Educational Codeforces Round 26 题意: 选k个数相乘让末尾0最多 分析: 第i个数 ...

  5. Educational Codeforces Round 26 [ D. Round Subset ] [ E. Vasya's Function ] [ F. Prefix Sums ]

    PROBLEM D - Round Subset 题 OvO http://codeforces.com/contest/837/problem/D 837D 解 DP, dp[i][j]代表已经选择 ...

  6. Educational Codeforces Round 26 D dp

    D. Round Subset time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  7. Educational Codeforces Round 26 F. Prefix Sums 二分,组合数

    题目链接:http://codeforces.com/contest/837/problem/F 题意:如题QAQ 解法:参考题解博客:http://www.cnblogs.com/FxxL/p/72 ...

  8. Educational Codeforces Round 26 E - Vasya's Function

    数论题还是好恶心啊. 题目大意:给你两个不超过1e12的数 x,y,定义一个f ( x, y ) 如果y==0 返回 0 否则返回1+ f ( x , y - gcd( x , y ) ); 思路:我 ...

  9. Educational Codeforces Round 26 A B C题

    题目链接 A. Text Volume 题意:计算句子中,每个单词大写字母出现次数最多的那个的出现次数(混不混乱QAQ). 解题思路:注意getchar()就没啥了. #include<cstd ...

随机推荐

  1. SkylineGlobe Android 开发 面积计算示例代码

    SkylineGlobe Android 开发 面积计算示例代码: 如果之前熟悉SkylineGlobe桌面端的二次开发,看这些代码应该不难理解. package com.skyline.terrae ...

  2. mqtt 客户端 基于Python

    这几天一直在搞安全通信,微信小程序,反向代理等等,为了能让自己对整个系统做到把控,主要是需要了解每一个细节的地方,所以今天花了3个小时的时间学习了Python,因为我要用它来做Http和WebSock ...

  3. 17-(基础入门篇)GPRS(Air202)串口

    https://www.cnblogs.com/yangfengwu/p/9968716.html 现在看一下官方给的demo 其实只要有两个就好说了 module(...,package.seeal ...

  4. 《Head First 设计模式》例子的C++实现(1 策略模式)

    最近在学习设计模式,用的是 <Head First 设计模式>这本书.感觉这本书写的还是很不错的,深入浅出的介绍了各种常用的设计模式.唯一有点不方便的地方是这本书的例子全都是用的 Java ...

  5. 浅谈js拖拽

    本文来自网易云社区 作者:刘凌阳 前言 本文依据半年前本人的分享<浅谈js拖拽>撰写,算是一篇迟到的文章. 基本思路 虽然现在关于拖拽的组件库到处都是,HTML5也把拖放纳入了标准.但考虑 ...

  6. 【精】【入门篇】js正则表达式

    前言 最近有了点时间,就回头看了一下<学习正则表达式>这本书.怎么说呢,这本书适合从零开始学习正则表达式或者有一点基础但是想要加强这方面能力的读者.这本书的风格是“实践出真知”,使用归纳方 ...

  7. Dubbo(四) Dubbo-Admin项目 Dubbo管理台

    前言 在dubbo项目中,有注册中心,消费者,提供者就足以构成一个完整的项目了.但是仅仅有这三个角色,很难对整个项目状态有直观的了解,以及对项目操作. 因此早有前辈对此原因作出了贡献——一个通用的du ...

  8. BugPhobia开发终结篇章:Beta阶段第XI次Scrum Meeting

    0x01 :Scrum Meeting基本摘要 Beta阶段第十一次Scrum Meeting 敏捷开发起始时间 2015/01/06 00:00 A.M. 敏捷开发终止时间 2016/01/10 0 ...

  9. 网易云课堂-----Linux内核分析-----期末主观题

    姚歌 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 下面是对8个课题的 ...

  10. iOS中单例创建时不严格造成的问题和解决方法

    这次项目中遇到了一个单例创建不严格造成了的问题.简单说来就是在有的地方使用了alloc创建了多个实例,当然如果严格按照接口的方法调用是不会有问题的,但是如果项目碰到有不太熟悉的人使用时在处理时就会出现 ...