2013 - ECJTU 暑期训练赛第七场-problem-F
2013-08-07 18:24
369 查看
F -O.O
Crawling in process...Crawling failedTime
Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
SubmitStatusPractice
CodeForces 90A
Description
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 exactly30 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 time0) is painted red. Determine the least time it will take all students to ascend to the mountain top.
Input
The first line contains three integersr,g andb (0 ≤ r, g, b ≤ 100).
It is guaranteed thatr + g + b > 0, it means that the group consists of at least one student.
Output
Print a single number — the minimal time the students need for the whole group to ascend to the top of the mountain.
Sample Input
Input
Output
Input
Output
Crawling in process...Crawling failedTime
Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
SubmitStatusPractice
CodeForces 90A
Description
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 exactly30 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 time0) is painted red. Determine the least time it will take all students to ascend to the mountain top.
Input
The first line contains three integersr,g andb (0 ≤ r, g, b ≤ 100).
It is guaranteed thatr + g + b > 0, it means that the group consists of at least one student.
Output
Print a single number — the minimal time the students need for the whole group to ascend to the top of the mountain.
Sample Input
Input
1 3 2
Output
34
Input
3 2 1
Output
33
AC代码:
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<cstdlib> using namespace std; int s[3]; int main() { int r,g,b,i,Time; s[0]=1; s[1]=2; s[2]=0; while(cin>>r>>g>>b) { Time=0; i=0; for(i=0;(r+g+b)>0;i=s[i]) { if(i==0) { if(r>=2) { r-=2; Time+=1; } else if(r>0) { r=0; Time+=1; } else if(r==0) { Time+=1; } } if(i==1) { if(g>=2) { g-=2; Time+=1; } else if(g>0) { g=0; Time+=1; } else if(g==0) Time+=1; } if(i==2) { if(b>=2) { b-=2; Time+=1; } else if(b>0) { b=0; Time+=1; } else if(b==0) { Time+=1; } } } cout<<Time+30-1<<endl; } return 0; }
相关文章推荐
- 2013 - ECJTU 暑期训练赛第七场-problem-G
- 2013 - ECJTU 暑期训练赛第七场-problem-A
- 2013 - ECJTU 暑期训练赛第七场-problem-G
- 2013 - ECJTU 暑期训练赛第七场-problem-H
- 2013 - ECJTU 暑期12级训练赛第一场-problem-C
- 2013 - ECJTU 暑期训练赛第三场-problem-F
- 2013 - ECJTU 暑期12级训练赛第一场-problem-E
- 2013 - ECJTU 暑期训练赛第二场-problem-A
- 2013 - ECJTU 暑期训练赛第四场-problem-A
- 2013 - ECJTU 暑期训练赛第六场-problem-F
- 2013 - ECJTU 暑期训练赛第二场-problem-E
- 2013 - ECJTU 暑期训练赛第六场-problem-G
- 2013 - ECJTU 暑期训练赛第二场-problem-G
- 2013 - ECJTU 暑期训练赛第三场-problem-J
- 2013 - ECJTU 暑期训练赛第二场-problem-H
- 2013 - ECJTU 暑期12级训练赛第一场-Problem-H
- 2013 - ECJTU 暑期训练赛第四场-problem-C
- 2013 - ECJTU 暑期训练赛第八场-problem-A
- 2013 - ECJTU 暑期训练赛第二场-problem-J
- 2013 - ECJTU 暑期训练赛第八场-problem-B