这场比赛并没有打现场,昨天晚上做了ABCD四道题,今天做掉了E题

  以前还没有过切完一场比赛的所有题呢~爽~


A. Tavas and Nafas
 

Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas.

His phone operating system is Tavdroid, and its keyboard doesn't have any digits! He wants to share his score with Nafas via text, so he has no choice but to send this number using words.

He ate coffee mix without water again, so right now he's really messed up and can't think.

Your task is to help him by telling him what to type.

  最简单的模拟题..我还是喜欢定义三个常量来解决~跪跪手速帝(由于不是现场打所以慢悠悠地写

  心想如果是现场应该会紧张拼错好多个单词WA掉吧..QAQ


B. Tavas and SaDDas
 

Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones and told him: "If you solve the following problem, I'll return it to you."

The problem is:

You are given a lucky number n. Lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

If we sort all lucky numbers in increasing order, what's the 1-based index of n?

Tavas is not as smart as SaDDas, so he asked you to do him a favor and solve this problem so he can have his headphones back.

  首先我们需要统计所有位数小于这个数的数字

  显然n为位lucky number有2^n个

  然后接下来对于每一位,我们统计:

  所有在这一位前的都等于原数,这一位小于原数的数

  所以只有当某位为7的时候我们才累加答案

  也就是这一位后面可以随意取

  最后答案+1输出即可


 C. Tavas and Karafs

  Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.

Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + (i - 1) × B.

For a given m, let's define an m-bite operation as decreasing the height of at most m distinct not eaten Karafses by 1. Karafs is considered as eaten when its height becomes zero.

Now SaDDas asks you n queries. In each query he gives you numbers lt and m and you should find the largest number r such that l ≤ r and sequence sl, sl + 1, ..., sr can be eaten by performing m-bite no more than t times or print -1 if there is no such number r.

  C题首先我们需要证明一个东西:

    对于一个区间[l,r]若(m*t>=sigma(s[i])(l<=i<=r))&(t>=max(s[i])(l<=i<=r))那么这个区间满足要求

  刚开始觉得这个结论并不正确...

  后来思考了一下,首先很显然,任意一个条件不满足肯定不可行,必要性得证

  接着,我们思考m<=(r-l+1)的时候,我们每次都可以在剩下的地方取m个

  由于m*t>=sigma(s[i]),所以显然是取得完的

  m>(r-l+1)的时候,我们每次都把所有l~r的数取一遍,由于t>=max(s[i]),所以显然也是取得完的

  充分性得证

  接下来简单的二分的就可以了


D. Tavas and Malekas
 

Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead.

Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a little process on s. Malekas has a favorite string p. He determined all positions x1 < x2 < ... < xk where p matches s. More formally, for each xi (1 ≤ i ≤ k) he condition sxisxi + 1... sxi + |p| - 1 = pis fullfilled.

Then Malekas wrote down one of subsequences of x1, x2, ... xk (possibly, he didn't write anything) on a piece of paper. Here a sequence b is a subsequence of sequence a if and only if we can turn a into b by removing some of its elements (maybe no one of them or all).

After Tavas woke up, Malekas told him everything. He couldn't remember string s, but he knew that both p and s only contains lowercase English letters and also he had the subsequence he had written on that piece of paper.

Tavas wonders, what is the number of possible values of s? He asked SaDDas, but he wasn't smart enough to solve this. So, Tavas asked you to calculate this number for him.

Answer can be very large, so Tavas wants you to print the answer modulo 109 + 7.

  D题意很简单,就是给出给出一个字符串p,和它在字符串s中的一些匹配位置,以及s的位数

  判断是否存在这样的字符串,以及存在的话这样的字符串的个数

  首先,匹配位置是所有匹配位置的subsequence实际上是对问题的简化,我们考虑其他位置的时候

  就不需要再考虑是否又构成了一次匹配

  然后对于s的个数其实很简单...我们考虑匹配完全不重叠的情况,那些没有p覆盖的位置位数设为x

  则26^x就是答案

  然而实际上这道题的主要问题都在判断是否存在,简单的扩展KMP的应用

  //再去巩固一下KMP 扩展KMP 后缀数组这些东西各个数组的含义 以免下次套用错算法


E. Tavas and Pashmaks
 

Tavas is a cheerleader in the new sports competition named "Pashmaks".

This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be more than one winner).

Before the match starts, Tavas knows that there are n competitors registered for the match. Also, he knows that i-th person's swimming speed is si meters per second and his/her running speed is ri meters per second. Unfortunately, he doesn't know the values of R and S, but he knows that they are real numbers greater than 0.

As a cheerleader, Tavas wants to know who to cheer up. So, he wants to know all people that might win. We consider a competitor might win if and only if there are some values of R and S such that with these values, (s)he will be a winner.

Tavas isn't really familiar with programming, so he asked you to help him.

  E题首先我们可以把每个人的两个数据(x,y)转化成(1/x,1/y)将新数设为(a,b)

  最后的答案s/x+r/y=sx+ry

  

  我们考虑1,3,2三个点,4是3号点作与x轴的平行线与线段12的交点

  首先,与合金问题相似,我们设1(x1,y1),2(x2,y2)

  4(ax1+bx2,ay1+by2),ans = s(ax1+bx2) + r(ay1+by2)

  = a(sx1+ry1)+b(sx2+ry2) (0<a,b<1)

  不仅4号点的x,y坐标是1,2两点的混合,最后的ans也是x,y答案的混合

  那么也就是min(ans1,ans2)<=ans4<=max(ans1,ans2)

  然而3号点显然答案<4号点,所以3号点不可能成为winner

  于是转化成了凸包的问题

  然而需要注意几个问题

  1)加的点:我们需要加右上角左上角右下角各一点来维护凸包

        然而左上与右下不能直接等于边界的值,因为这样就不能去除掉边上的点

        然而也不能大于边界的值太多..因为可能会排除掉很多不应该排除的点

        所以最后赋一个边界的值-eps 卡卡精度应该就可以了(可是考试的时候怎么办啊TAT

  2)精度问题:判一判eps

  3)重点问题:显然做Graham算法是不能存在重点的

          于是我们添加的时候加一条if语句重点不再进

         最后累积答案的时候再处理一下即可


  还是非常喜欢CF的题,由于时间限制的关系不会出一些数据结构题

  平时多做做这样的题练练思维和手速真的很棒

  还有以后还是尽量打现场,会有不一样的感受

  20/.Apr.

  

  

  

  

Codeforces Round #299 Div2 解题报告的更多相关文章

  1. Codeforces Round#320 Div2 解题报告

    Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...

  2. Codeforces Round 665 赛后解题报告(暂A-D)

    Codeforces Round 665 赛后解题报告 A. Distance and Axis 我们设 \(B\) 点 坐标为 \(x(x\leq n)\).由题意我们知道 \[\mid(n-x)- ...

  3. Codeforces Round 662 赛后解题报告(A-E2)

    Codeforces Round 662 赛后解题报告 梦幻开局到1400+的悲惨故事 A. Rainbow Dash, Fluttershy and Chess Coloring 这个题很简单,我们 ...

  4. Codeforces Round #277.5 解题报告

    又熬夜刷了cf,今天比正常多一题.比赛还没完但我知道F过不了了,一个半小时贡献给F还是没过--应该也没人Hack.写写解题报告吧= =. 解题报告例如以下: A题:选择排序直接搞,由于不要求最优交换次 ...

  5. Codeforces Educational Round 92 赛后解题报告(A-G)

    Codeforces Educational Round 92 赛后解题报告 惨 huayucaiji 惨 A. LCM Problem 赛前:A题嘛,总归简单的咯 赛后:A题这种**题居然想了20m ...

  6. Codeforces Round #539 div2

    Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...

  7. 【前行】◇第3站◇ Codeforces Round #512 Div2

    [第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...

  8. 二分搜索 Codeforces Round #299 (Div. 2) C. Tavas and Karafs

    题目传送门 /* 题意:给定一个数列,求最大的r使得[l,r]的数字能在t次全变为0,每一次可以在m的长度内减1 二分搜索:搜索r,求出sum <= t * m的最大的r 详细解释:http:/ ...

  9. 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas

    题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {" ...

随机推荐

  1. Windows系统的高效使用

    1-WIndows10系统的入门使用 2-如何把系统盘的用户文件转移到其他盘 3-Windows装机软件一般有哪些? 4-Windows系统有哪些比较好用的下载器? 5-Windows系统中的播放器 ...

  2. shiro笔记

    控制某一角色拥有此选项 上图 标签为shiro:hasRole表示 此时只有admin角色才拥有 系统用户管理和角色管理两个tab 页 上图 标签为shiro:hasPermission表示 此时只有 ...

  3. JSONP跨域jQuery处理整理(附天气数据实例)

    写在前面 跨域的解决方案有多种,其中最常见的是使用同一服务器下的代理来获取远端数据,再通过ajax进行读取,而在这期间经过了两次请求过程,使得获取数据的效率大大降低,这篇文章蓝飞就为大家介绍一下解决跨 ...

  4. linux学习(一)——学习之路

    首先,要学Linux编程,你得会用Linux,也就是得在命令行环境下生存下来.什么叫生存下来呢?就是我现在给你一台主机,键盘,显示器啥的,然后给你一个服务器版的Linux系统的光盘或者其他什么安装盘, ...

  5. 并查集——hdu1213(入门)

    传送门:How Many Tables 模板代入 判断几个连通分支 DFS亦可完成 [并查集] #include <iostream> #include <cstdio> #i ...

  6. DFS——CodeForces740DAlyona and a tree

    一.题目回顾 题目链接:Alyona and a tree Examples Input 52 5 1 4 61 71 13 53 6 Output 1 0 1 0 0   Input 59 7 8 ...

  7. linux 进程间通信之pipe

    在实际开发过程中,程序员必须让拥有依赖关系的进程集协调,这样才能达到进程的共同目标.  每个进程各自有不同的用户地址空间,任何一个进程的全局变量在另一个进程中都看不到,所以进程之间要交换数据必须通过内 ...

  8. HDU 1005 Wooden Sticks

    http://acm.hdu.edu.cn/showproblem.php?pid=1051 Problem Description There is a pile of n wooden stick ...

  9. Java中WeakHashMap实现原理深究

    一.前言 我发现Java很多开源框架都使用了WeakHashMap,刚开始没怎么去注意,只知道它里面存储的值会随时间的推移慢慢减少(在 WeakHashMap 中,当某个“弱键”不再正常使用时,会被从 ...

  10. Windows 64下elasticsearch-1.7.1集群 安装、启动、停止

    elasticsearch-1.7.1 (es Windows 64) 安装.启动.停止的详细记录 https://blog.csdn.net/qq_27093465/article/details/ ...