CF90A.Cableway

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A group of university students wants to get to the top of a mountain to have a picnic there. For that they decided to use a cableway.

A cableway is represented by some cablecars, hanged onto some cable stations by a cable. A cable is scrolled cyclically between the first and the last cable stations (the first of them is located at the bottom of the mountain and the last one is located at the top). As the cable moves, the cablecar attached to it move as well.

The number of cablecars is divisible by three and they are painted three colors: red, green and blue, in such manner that after each red cablecar goes a green one, after each green cablecar goes a blue one and after each blue cablecar goes a red one. Each cablecar can transport no more than two people, the cablecars arrive with the periodicity of one minute (i. e. every minute) and it takes exactly 30 minutes for a cablecar to get to the top.

All students are divided into three groups: r of them like to ascend only in the red cablecars, g of them prefer only the green ones and b of them prefer only the blue ones. A student never gets on a cablecar painted a color that he doesn't like,

The first cablecar to arrive (at the moment of time 0) is painted red. Determine the least time it will take all students to ascend to the mountain top.

一群大学生想去山顶野餐。为此,他们决定乘坐缆车。

缆车系统由若干个缆车车厢组成,这些车厢通过钢缆悬挂在若干个缆车站上。钢缆在第一个缆车站(位于山脚)和最后一个缆车站(位于山顶)之间循环滚动。随着钢缆的运动,其上悬挂的缆车车厢也随之运动。

缆车车厢的数量是 3 的倍数,且按红、绿、蓝三种颜色涂装,涂装顺序为:每个红色车厢之后是一个绿色车厢,每个绿色车厢之后是一个蓝色车厢,每个蓝色车厢之后又是一个红色车厢。每个缆车车厢最多可载 2 人;缆车车厢以每分钟一班的频率到达(即每分钟到达一班);且从山脚到山顶恰好需要 30 分钟。

所有学生被分为三组:有 $ r $ 名学生只愿意乘坐红色缆车,$ g $ 名学生只愿意乘坐绿色缆车,$ b $ 名学生只愿意乘坐蓝色缆车。一名学生绝不会乘坐他不喜欢的颜色的缆车。

第 1 班到达的缆车(在时刻 $ 0 $ 到达)为红色。请确定所有学生全部抵达山顶所需的最短时间。

输入格式

The first line contains three integers r, g and b (0 ≤ r, g, b ≤ 100). It is guaranteed that r + g + b > 0, it means that the group consists of at least one student.

第一行包含三个整数 rr、gg 和 bb(0 ≤ r, g, b ≤ 1000 \le r,\,g,\,b \le 100)。保证 r + g + b > 0r + g + b > 0,即该小组至少包含一名学生。

输出格式

Print a single number — the minimal time the students need for the whole group to ascend to the top of the mountain.

输出一个整数——学生全体登上山顶所需的最短时间。

输入输出样例

  • 输入#1

    1 3 2

    输出#1

    34
  • 输入#2

    3 2 1

    输出#2

    33

说明/提示

Let's analyze the first sample.

At the moment of time 0 a red cablecar comes and one student from the r group get on it and ascends to the top at the moment of time 30.

At the moment of time 1 a green cablecar arrives and two students from the g group get on it; they get to the top at the moment of time 31.

At the moment of time 2 comes the blue cablecar and two students from the b group get on it. They ascend to the top at the moment of time 32.

At the moment of time 3 a red cablecar arrives but the only student who is left doesn't like red and the cablecar leaves empty.

At the moment of time 4 a green cablecar arrives and one student from the g group gets on it. He ascends to top at the moment of time 34.

Thus, all the students are on the top, overall the ascension took exactly 34 minutes.

我们来分析第一个样例。

在时刻 0,一辆红色缆车到达,一名来自 rr 组的学生登上缆车,并于时刻 30 到达山顶。

在时刻 1,一辆绿色缆车到达,两名来自 gg 组的学生登上缆车;他们于时刻 31 到达山顶。

在时刻 2,一辆蓝色缆车到达,两名来自 bb 组的学生登上缆车;他们于时刻 32 到达山顶。

在时刻 3,一辆红色缆车到达,但此时唯一剩余的学生不喜欢红色,因此该缆车空载离开。

在时刻 4,一辆绿色缆车到达,一名来自 gg 组的学生登上缆车;他于时刻 34 到达山顶。

因此,所有学生均抵达山顶,整个上山过程恰好耗时 34 分钟。

输入解题思路,AI测评打分。不知道怎么写?

首页