题目链接:

hdu5054 Alice and Bob

思路:
就是(x,y)在两个參考系中的表示演全然一样。那么仅仅可能在这个矩形的中点。。
题目:

Alice and Bob

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 216    Accepted Submission(s): 166

Problem Description
Bob and Alice got separated in the Square, they agreed that if they get separated, they'll meet back at the coordinate point (x, y). Unfortunately they forgot to define the origin of coordinates and the coordinate axis direction. Now, Bob in the lower left
corner of the Square, Alice in the upper right corner of the the Square. Bob regards the lower left corner as the origin of coordinates, rightward for positive direction of axis X, upward for positive direction of axis Y. Alice regards the upper right corner
as the origin of coordinates, leftward for positive direction of axis X, downward for positive direction of axis Y. Assuming that Square is a rectangular, length and width size is N * M. As shown in the figure:




Bob and Alice with their own definition of the coordinate system respectively, went to the coordinate point (x, y). Can they meet with each other ? 

Note: Bob and Alice before reaching its destination, can not see each other because of some factors (such as buildings, time poor).
 
Input
There are multiple test cases. Please process till EOF. Each test case only contains four integers : N, M and x, y. The Square size is N * M, and meet in coordinate point (x, y). ( 0 < x < N <= 1000 , 0 < y < M <= 1000 ).
 
Output
If they can meet with each other, please output "YES". Otherwise, please output "NO".
 
Sample Input
  1. 10 10 5 5
  2. 10 10 6 6
 
Sample Output
  1. YES
  2. NO
 
Source
 
Recommend
heyang   |   We have carefully selected several similar problems for you:  5057 5052 5051 5050 5049 

代码:
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<algorithm>
  5. #include<map>
  6. #include<vector>
  7. #include<cmath>
  8. #include<string>
  9. #include<queue>
  10. #define eps 1e-9
  11. #define ll long long
  12. #define INF 0x3f3f3f3f
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17. int x,y,n,m;
  18. while(scanf("%d%d%d%d",&n,&m,&x,&y)!=EOF)
  19. {
  20. if(2*x==n&&2*y==m)
  21. printf("YES\n");
  22. else
  23. printf("NO\n");
  24. }
  25. }

hdu 5055 Bob and math problem

题意:
就是给出n个数字,然后要你找到一个满足例如以下条件的数。
(1)这个数是奇数。
(2)这个数是是最大的数。
(3)另一个被cha的点是全部的数字都要用到。我就是0 0 1 被cha了。。我还有益特判这样的情况,都是题目没有读懂啊。。
思路:
贪心的做法,首先看全部的位是否存在基数,假设基数都没有,那么肯定是不存在这样的数的,其次假设有,那么就将最小的基数找出来做各位,然后将全部的位进行排序,然后从低位向高位赋值,那么就得到这个树了,最后推断一下,假设首位为0,那么这个数就是不存在的,由于要求输出全部的位。。
题目:

Bob and math problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 643    Accepted Submission(s): 245

Problem Description
Recently, Bob has been thinking about a math problem.

There are N Digits, each digit is between 0 and 9. You need to use this N Digits to constitute an Integer.

This Integer needs to satisfy the following conditions:

  • 1. must be an odd Integer.
  • 2. there is no leading zero.
  • 3. find the biggest one which is satisfied 1, 2.

Example: 

There are three Digits: 0, 1, 3. It can constitute six number of Integers. Only "301", "103" is legal, while "130", "310", "013", "031" is illegal. The biggest one of odd Integer is "301".

 
Input
There are multiple test cases. Please process till EOF.

Each case starts with a line containing an integer N ( 1 <= N <= 100 ).

The second line contains N Digits _1, a_2, a_3, \cdots, a_n. ( 0 \leqwhich indicate the digit $a a_i \leq 9)$.
 
Output
The output of each test case of a line. If you can constitute an Integer which is satisfied above conditions, please output the biggest one. Otherwise, output "-1" instead.
 
Sample Input
  1. 3
  2. 0 1 3
  3. 3
  4. 5 4 2
  5. 3
  6. 2 4 6
 
Sample Output
  1. 301
  2. 425
  3. -1
 
Source
 
Recommend
heyang   |   We have carefully selected several similar problems for you:  5057 5052 5051 5050 5049 
 

代码:

  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<algorithm>
  5. #include<map>
  6. #include<vector>
  7. #include<cmath>
  8. #include<string>
  9. #include<queue>
  10. #define eps 1e-9
  11. #define ll long long
  12. #define INF 0x3f3f3f3f
  13. using namespace std;
  14. const int maxn=100+10;
  15. int a[maxn],odd[maxn];
  16. char str[maxn];
  17. int n;
  18.  
  19. int main()
  20. {
  21. int ans,pd;
  22. while(scanf("%d",&n)!=EOF)
  23. {
  24. memset(str,0,sizeof(str));
  25. int cnt=0,first=0;
  26. for(int i=1;i<=n;i++)
  27. {
  28. scanf("%d",&a[i]);
  29. if(a[i]%2)
  30. odd[++cnt]=a[i];
  31. }
  32. sort(odd+1,odd+1+cnt);
  33. sort(a+1,a+1+n);
  34. int ly=n-1;
  35. if(cnt==0)
  36. puts("-1");
  37. else
  38. {
  39. str[ly]=odd[1]+'0';
  40. ly--;
  41. for(int i=1;i<=n;i++)
  42. {
  43. if(a[i]==odd[1]&&!first)
  44. {
  45. first=1;
  46. continue;
  47. }
  48. else
  49. {
  50. str[ly]=a[i]+'0';
  51. ly--;
  52. }
  53. }
  54. if(str[0]=='0')
  55. puts("-1");
  56. else
  57. {
  58. for(int i=0;i<=n-1;i++)
  59. printf("%c",str[i]);
  60. printf("\n");
  61. }
  62. }
  63. }
  64. return 0;
  65. }

hdu 5056 Boring count
题意:
给出一个字符串,然后求出它全部的子串中每一个字母的数目不超过k个的全部的子串的数目。。
思路:
枚举每一个字符,然后以每一个字符i为子串末尾,然后得到的满足条件的子串的最长长度。。就算字母同样,仅仅要位置不同样就算不同的。。2333333333,那么思路就是维护一个起点st,每当第i个字符的数目大于k后,那么就将st后移,同一时候将当前的每一个cnt[i]减减,直到移动到与i同样的字符你,那么从st到i这段字符就满足条件了。。。认为这个思路真是奇妙。。。。
题目;

Boring count

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 451    Accepted Submission(s): 169

Problem Description
You are given a string S consisting of lowercase letters, and your task is counting the number of substring that the number of each lowercase letter in the substring is no more than K.
 
Input
In the first line there is an integer T , indicates the number of test cases.

For each case, the first line contains a string which only consist of lowercase letters. The second line contains an integer K.



[Technical Specification]

1<=T<= 100

1 <= the length of S <= 100000

1 <= K <= 100000
 
Output
For each case, output a line contains the answer.
 
Sample Input
  1. 3
  2. abc
  3. 1
  4. abcabc
  5. 1
  6. abcabc
  7. 2
 
Sample Output
  1. 6
  2. 15
  3. 21
 
Source
 
Recommend
heyang   |   We have carefully selected several similar problems for you:  5057 5052 5051 5050 5049 
代码:
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<algorithm>
  5. #include<map>
  6. #include<vector>
  7. #include<cmath>
  8. #include<string>
  9. #include<queue>
  10. #define eps 1e-9
  11. #define ll long long
  12. #define INF 0x3f3f3f3f
  13. using namespace std;
  14.  
  15. const int maxn=100000+10;
  16. char str[maxn];
  17. int cnt[28];
  18.  
  19. int main()
  20. {
  21. ll ans;
  22. int t,st,k,ly;
  23. scanf("%d",&t);
  24. while(t--)
  25. {
  26. memset(cnt,0,sizeof(cnt));
  27. st=ans=0;
  28. scanf("%s%d",str,&k);
  29. for(int i=0;str[i]!='\0';i++)
  30. {
  31. ly=str[i]-'a';
  32. cnt[ly]++;
  33. if(cnt[ly]>k)
  34. {
  35. while(str[st]!=str[i])
  36. {
  37. cnt[str[st]-'a']--;
  38. st++;
  39. }
  40. cnt[ly]--;
  41. st++;
  42. }
  43. ans+=i-st+1;
  44. }
  45. printf("%I64d\n",ans);
  46. }
  47. return 0;
  48. }


BestCoder Round #11 (Div. 2) 前三题题解的更多相关文章

  1. Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) (前三题题解)

    这场比赛好毒瘤哇,看第四题好像是中国人出的,怕不是dllxl出的. 第四道什么鬼,互动题不说,花了四十五分钟看懂题目,都想砸电脑了.然后发现不会,互动题从来没做过. 不过这次新号上蓝名了(我才不告诉你 ...

  2. Codeforces Round #609 (Div. 2)前五题题解

    Codeforces Round #609 (Div. 2)前五题题解 补题补题…… C题写挂了好几个次,最后一题看了好久题解才懂……我太迟钝了…… 然后因为longlong调了半个小时…… A.Eq ...

  3. Codeforces Round #460 (Div. 2) 前三题

    Problem A:题目传送门 题目大意:给你N家店,每家店有不同的价格卖苹果,ai元bi斤,那么这家的苹果就是ai/bi元一斤,你要买M斤,问最少花多少元. 题解:贪心,找最小的ai/bi. #in ...

  4. Codeforces Round #524 (Div. 2)(前三题题解)

    这场比赛手速场+数学场,像我这样读题都读不大懂的蒟蒻表示呵呵呵. 第四题搞了半天,大概想出来了,但来不及(中途家里网炸了)查错,于是我交了两次丢了100分.幸亏这次没有掉rating. 比赛传送门:h ...

  5. BestCoder Round #11 (Div. 2) 题解

    HDOJ5054 Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  6. bestcoder Round #7 前三题题解

    BestCoder Round #7 Start Time : 2014-08-31 19:00:00    End Time : 2014-08-31 21:00:00Contest Type : ...

  7. BestCoder Round #85 前三题题解

    sum Accepts: 822 Submissions: 1744 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/13107 ...

  8. Codeforces Round #530 (Div. 2) (前三题题解)

    总评 今天是个上分的好日子,可惜12:30修仙场并没有打... A. Snowball(小模拟) 我上来还以为直接能O(1)算出来没想到还能小于等于0的时候变成0,那么只能小模拟了.从最高的地方进行高 ...

  9. BestCoder Round #11 (Div. 2)

    太菜,仅仅能去Div2.(都做不完 ORZ... 各自是 HDU: 5054pid=5054"> Alice and Bob 5055Bob and math problem 5056 ...

随机推荐

  1. ubuntu下eclipse java ee首次打开提示找不到jdk的问题

    最近想搭建一个本地服务器,方便写一些网络请求相关的demo,遂下载了eclipse  ee版 ( IDEA证书好贵,暂时不想买-=-),下载---解压 一切正常,但是当在terminal下打开ecli ...

  2. 轻松八步搞定Cacti配置安装(原创视频)

    轻松八步搞定Cacti配置安装 1.安装web server $sudo apt-get install apache2 验证 http://localhost 2.$sudo apt-get ins ...

  3. spark ml阅读笔记

    参考文档:http://www.cnblogs.com/huliangwen/p/7491797.html

  4. myBatis通过逗号分隔字符串,foreach

    前言 当数据库里存储的值是以逗号分隔格式存储的字符串时. 数据格式如下:  id name  ids   1  张三  a,b,c  2  李四  c,d,e 我们拿到的条件参数是:b,e 1.后台通 ...

  5. 关于MySQL utf8mb4 字符集中字符串长度的问题

    MySQL之前推出的utf8字符集中,一个汉字占3个字节,新的utf8mb4字符集中一个汉字占4个字节. 那么我们平时建表的时候输入的varchar=16这种,到底指的是字符长度还是字节长度? 如果是 ...

  6. C# Unity依赖注入利用Attribute实现AOP功能

    使用场景? 很多时候, 我们定义一个功能, 当我们要对这个功能进行扩展的时候, 按照常规的思路, 我们一般都是利用OOP的思想, 在原有的功能上进行扩展. 那么有没有一种东西, 可以实现当我们需要扩展 ...

  7. 洛谷 P2873 [USACO07DEC]泥水坑Mud Puddles

    P2873 [USACO07DEC]泥水坑Mud Puddles 题目描述 Farmer John is leaving his house promptly at 6 AM for his dail ...

  8. OrmLite使用小结(一)

    在使用OrmLite过程中,遇到了不少问题.鉴于中文文档比較少,看英文文档又不知道怎样看起.仅仅能遇到问题查找解决方法并整理出来,如有错误,希望能指正! ** 1.模糊条件查询 ** 使用条件查询时. ...

  9. 1.JPA概要

    转自:https://www.cnblogs.com/holbrook/archive/2012/12/30/2839842.html JPA定义了Java ORM及实体操作API的标准.本文摘录了J ...

  10. 关于VUE的一些指令的介绍

    V-cloak 这是一个不常用的指令,出现这个指令的原因是因为有时候网络速度慢,还没加载完vue,代码就开始编译了,这个时候渲染出来的内容就可想而知了 <!DOCTYPE html> &l ...