这一题写了好久也是醉了。。直接模拟即可,注意difference是任意两个count的差,x,y,z不一定按照R,Y,B的顺序。

#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<vector>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<ctype.h>
#include<map>
#include<time.h>
#include<bitset>
#include<set>
#include<list>
using namespace std;
//hiho 1135const int maxn=20010;
char str[maxn];
int x;
int y;
int z;
int num[3];//0 for r, 1 for y, 2 for b
int ans;
bool judge()
{
//    if(abs(num[0]-num[1])==x&&abs(num[1]-num[2])==y&&abs(num[2]-num[0])==z)
//    {
//        return true;
//    }bool flgx=false;bool flgy=false;bool flgz=false;pair<int,int>idxx;pair<int,int>idxy;for(int i=0;i<3;i++){for(int j=i+1;j<3;j++){if(abs(num[i]-num[j])==x){flgx=true;idxx.first=i;idxx.second=j;break;}}}for(int i=0;i<3;i++){for(int j=i+1;j<3;j++){if(abs(num[i]-num[j])==y){if(!(idxx.first==i&&idxx.second==j)){flgy=true;idxy.first=i;idxy.second=j;break;}}}}for(int i=0;i<3;i++){for(int j=i+1;j<3;j++){if(abs(num[i]-num[j])==z){if(idxx.first==i&&idxx.second==j) continue;if(idxy.first==i&&idxy.second==j) continue;flgz=true;break;}}}if(flgx&&flgy&&flgz){return true;}return false;
}
int main()
{freopen("input.txt","r",stdin);//freopen("data.txt","r",stdin);//freopen("out1.txt","w",stdout);scanf("%d %d %d",&x,&y,&z);scanf("%s",&str);int len=strlen(str);ans=0;for(int i=0;i<len;i++){if(str[i]=='R'){num[0]++;}else if(str[i]=='Y'){num[1]++;}else if(str[i]=='B'){num[2]++;}ans=max(ans,num[0]+num[1]+num[2]);// cout<<num[0]<<" "<<num[1]<<" "<<num[2]<<" "<<ans<<endl;if(judge()){//cout<<"here"<<endl;memset(num,0,sizeof(num));}}printf("%d\n",ans);return 0;
}

hihoCoder 1135 Magic Box 微软2016校园招聘在线笔试相关推荐

  1. 微软2016校园招聘在线笔试 B Professor Q's Software [ 拓扑图dp ]

    传送门 题目2 : Professor Q's Software 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Professor Q develops a new s ...

  2. [Hihocoder 1289] 403 Forbidden (微软2016校园招聘4月在线笔试)

    传送门 #1289 : 403 Forbidden 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi runs a web server. Someti ...

  3. 微软2016校园招聘9月在线笔试题解

    微软2016校园招聘9月在线笔试题解 题目网址列表:http://hihocoder.com/contest/mstest2015sept2/problems 题目一分析: 问题描述:在二维坐标系中, ...

  4. #hihocoder #1135 : Magic Box

    hihocoder #1135 : Magic Box 标签(空格分隔): hihocoder 1135 : Magic Box Description The circus clown Sunny ...

  5. hihoCoder #1135 : Magic Box

    题目地址:http://hihocoder.com/problemset/problem/1135 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 The circus ...

  6. 微软2016校园招聘4月在线笔试 hihocoder 1288 Font Size (模拟)

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Steven loves reading book on his phone. The book he reads now ...

  7. 2016京东校园招聘在线笔试回忆版

    1.linux下查找当前目录和子目录为.txt文件的命令为 Als ".txt "Bfind -name ".txt" Cls -d ".txt&qu ...

  8. 中兴2016校园招聘 硬件笔试(8.27)

    中兴硬件笔试(转自小伙伴) 单选:1.SSB信号检波(同步) 2.晶体三极管混频器的变频跨导 3.WCDMA系统的码片速率(3.84Mbps) 4.ARP请求与应答分别是(广播和单波) 5.TCAP对 ...

  9. 网易互娱2022校园招聘在线笔试-游戏研发工程师(第一批)

    文章目录 A 身份证合法性检查 B 田径排名 C 永远的七日之都 题目来源:牛客网 考试题型:3道程序题 考试时间:(北京时间,UTC+08:00)2021年08月07日 19:30:00 -- 22 ...

最新文章

  1. math_functions
  2. 整数加扰java_生成随机顺序,但在java中有约束
  3. 经典DL论文研读(part3)--Improving neural networks by preventing co-adaptation of feature detectors
  4. 使用function module CRM_BUPA_FRG0010_GET_VALIDLIST 获得某个account assign的sales area
  5. 打印三角形流程控制练习
  6. 【Java】存储单元的设计与模拟
  7. bigdicmal除法精度设置_java中BigDecimal进行加减乘除的基本用法
  8. sap系统ftp服务器下文件,sap ftp服务器
  9. 【干货】在拉斯维加斯,程序员如何靠bandits算法干掉老虎机
  10. 微软云存储SkyDrive API:将你的数据连接到任何应用、任何平台,及任何设备上
  11. python四子棋游戏
  12. word 的使用 —— 快捷键(分节符、分页符、分栏符)
  13. VScode中txt文件乱码解决
  14. 超过ChatGPT3达到ChatGPT4%90性能的小羊驼来了-Vicuna(校招社招必备,chatgpt风口来了赶紧学起来吧)
  15. 简单记录下手机root 过程
  16. 如何用ADB命令删除Android中的系统应用
  17. 【Image2Lcd X TFT_LCD】—— 图片取模软件使用
  18. 最全前端面试问题及答案总结(转载自hawx1993)
  19. 信安软考 第十五章 网络安全主动防御技术与应用
  20. devops工具-Ansible基础

热门文章

  1. 已知两点求直线一般方程,已知三点求平面一般方程
  2. 7z SFX Constructor 4.4中文版(文件自解压生成器)简介
  3. 歌名:死了都要try.
  4. 基于matlab的医学成像技术滤波反投影仿真,包括直接反投影,S-L滤波,R-L滤波,Lewitt滤波
  5. 创业股权以及企业治理体系图鉴
  6. 也许事情本身的意义,没你想的那么重要。
  7. html背景颜色上边白下边红,HTML中,网页正文的默认颜色是红色,背景颜色默认是白色。...
  8. 五大洲是哪五个区域?
  9. 文件在线预览doc,docx转换pdf(一)
  10. 苹果cms模板_泛目录站群神器,万词无限模板站群黑帽SEO程序