HDU 2633 Getting Driving License(模拟)
Getting Driving License
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 347 Accepted Submission(s): 78
you a lot of benefits. You will regret for not passing the driving test
or getting a driving license in your campus life. Why?College life is
filled with much spare time,which you can use to improve yourself in
many fields such as driving.
During the time of taking driving
lessons,Samuel met a lot of classmates whose time are occupied by their
own work. The fact that they have little time to practice makes getting
driving license increasingly difficult. Passing the driving test as
soon as possible is suggested by these mates to the our college students
who cannot drive.
Know something about the driving test you
can read the information in the background section,however,it is not
related with this problem firmly. Surely,you can go to the problem
section directly.
Here is the background information on owning driving licenses in China mainland:
To get a driving license successfully,you need to take about 4 tests at least.
The first part is the theory exam which helps you know clearly
about the transportation law in China mainland and other driving theory.
The second is to test you whether you can drive a car forward
out and backward in the garage at a very low speed(like aunts
moving),move the car from one garage to another and drive out.
The third section you need to pass is a little difficult than the
second test. In this section,you should be able to drive to avoid the
obstacles on the road,manage your car pass S formed way(your car's
wheels can not be moved onto one of the tracks which leads your way
out),after that you may have to make your car pass the 90 degree angle
track,then pass the course equipped with very low bridge using one side
of your car's wheel and so on.
The forth part which is test
the same day with the third test is called road driving test(but in the
problem I designed the time between Part 3 and Part 4 is 1 month,just
want to make the problem much easier).As you can refer from the word,it
tests the ability of driving on the road,it is more practical and of
more importance.
If you seems not very lucky,you will have
fifth section(The problem does not include the 5th part,you can ignore
it in solving the problem).In this part you are required to driving at
night which involves changing lights in addition . Teachers never taught
how to drive at night unless your group is asked to take part in this
test. But on the contrary,taught how to driving at night,of course,is
necessary. Samuel had an experience of taking the fifth test to get the
driving license in the summer of 2008. Tell you a secret,next time you
meet a car comes from an opposite direction and the driver of that car
does not change his front lights ,it probably means he/she needs special
training on how to drive at night.
To get a driving
license,you should pass the 4 parts one by one. For example,if you
failed in the section 2,you have to retry for a second time,third
time...before you pass. After that you have the opportunity to enter
Part 3.
Here is the problem section you need read patiently:
Some details you need to know:
1.The time between the two tests is generally about 1 month(If
you fail in the test on your first attempt,you can try it a second time.
Fail again the second time he have to go home and retry after 1 month).
2.And the time from you take the first test to your owning a license is within 2 years.
3.What's more,the passing score in Part 1 test is 90(that is to
say if you get 89 or even lower at your first attempt,a second attempt
is needed. You will pass until you get 90 or higher at the second
time)and each of the rest parts the passing score is 80 at least.
the
test cases t,each of the test case involves an integer n and n scores
one gets in the test and with n scores he passed the test or he failed
to pass in the 2 years(of course here n>=4). All the number here are
integers.
is simple. Just output the time one needs to get a driving license (if
time is within 2 years)using the format “It takes about m months to get a
driving license.”If time is beyond 2 years please output the sentence
“He failed to get a driving license within 2 years! ”
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 1044266558
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int n,x,t;
int main()
{
scanf("%d",&t);
while(t--)
{
int pos=,ok=,flag=,k=;
scanf("%d",&n);
for(int i=;i<n;i++)
{
scanf("%d",&x);
//printf("%d %d\n",x,pos);
if(flag==)
{
if(x<) ok++;
else if(x>=) {ok=;pos++,flag=;continue;}
if(ok==) pos+=,ok=;
}
else if(flag==)
{
if(x<) ok++;
else if(x>=) {ok=;pos++,flag=;continue;}
if(ok==) pos+=,ok=;
}
else if(flag==)
{
if(k==)
{
if(x<) ok++;
else if(x>=) {ok=;k=;continue;}
if(ok==) pos+=;
}
else if(k==)
{
if(x<) ok++;
else if(x>=) {ok=;continue;}
if(ok==) pos+=;
}
}
}
if(pos<=) printf("It takes about %d months to get a driving license.\n",pos);
else printf("He failed to get a driving license within 2 years!\n");
}
return ;
}
/*
4
17
70 70 70 70 95 70 70 70 95 70 70 70 95 70 70 70 95
5
89 90 95 84 80
7
80 90 70 80 75 85 80
7
80 90 70 70 80 85 85
*/
HDU 2633 Getting Driving License(模拟)的更多相关文章
- HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011亚洲北京赛区网络赛)
HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 ...
- HDU 5948 Thickest Burger 【模拟】 (2016ACM/ICPC亚洲区沈阳站)
Thickest Burger Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- HDU 5920 Ugly Problem 【模拟】 (2016中国大学生程序设计竞赛(长春))
Ugly Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tota ...
- HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)
Football Games Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)To ...
- HDU 4814 Golden Radio Base 模拟
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4814 题目大意: 把一个正整数表示为φ进制, φ = (1+√5)/2 . 且已知: 1. φ + 1 ...
- HDU 5504 GT and sequence 模拟
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5504 思路:模拟 代码: #include<stdio.h>//------杭电5504 ...
- hdu 5071 vector操作恶心模拟
http://acm.hdu.edu.cn/showproblem.php?pid=5071 对于每一个窗口,有两个属性:优先级+说过的单词数,支持8个操作:新建窗口,关闭窗口并输出信息,聊天(置顶窗 ...
- hdu 4902 线段树+逆向模拟
http://acm.hdu.edu.cn/showproblem.php?pid=4902 出n个数,然后对这n个数进行两种操作: 如果是 1 l r x,则把 [l, r] 区间里面的每一个数都变 ...
- HDU 5186 zhx's submissions 模拟,细节 难度:1
http://acm.hdu.edu.cn/showproblem.php?pid=5186 题意是分别对每一位做b进制加法,但是不要进位 模拟,注意:1 去掉前置0 2 当结果为0时输出0,而不是全 ...
随机推荐
- 新机器的vim配置
最近一直用vim去写acm代码,算是一种练习吧. 用着用着感觉不错,最近也稍微配置了一下vim,用着更舒服了 键盘映射 ESC<->CapsLock 我们知道vim有自带的键盘映射命令,但 ...
- Linux下的压缩与解压缩
1 .gz 1)压缩 root@xiaohuang-virtual-machine:/home/xiaohuang/桌面/hellow/hellow# gzip 2.txt 3.txt root@xi ...
- 【IDEA】Error: java: Compliance level '1.6' is incompatible with target level '1.8'. A compliance level '1.8' or better is required解决办法
在运行的时候常常出现如下错误: Error: java: Compliance level '1.6' is incompatible with target level '1.8'. A compl ...
- mod_php模式原理探析
1.PHP与Apache工作模式 在传统的LAMP架构中,PHP与Apache交互时,至少有两种方式『运行PHP』: 使用CGI:Apache发送请求至php-cgi进程,php-cgi进程调用PHP ...
- Android studio树形
原创作品,允许转载,转载时请务必声明作者信息和本声明. http://www.cnblogs.com/zhu520/p/8349553.html 这个是上网找了好久才弄出来的,我把我上网找的总结也写 ...
- storm 消息确认机制及可靠性
worker进程死掉 在一个节点 kill work进程 比方 kill 2509 对work没有影响 由于会在其它节点又一次启动进程运行topology任务 supervisor进程死掉 supe ...
- JSunpack-n模拟WireShark拦截文件传输
前言: 在前面的实验里我们进行了JSunpack-n的安装及其简单使用.JSunpack-n还有另外一些功能须要进行測试试验,由于本人也是刚接触这些东西.本文就当中一个"功能点"进 ...
- SharePoint创建Alternate Access Mapping (AAM)备用訪问映射
SharePoint创建Alternate Access Mapping (AAM)备用訪问映射 SharePoint的仓库是SQL Server中的内容数据库.这些数据库储存着组织全 ...
- Install the IIS 6.0 Management Compatibility Components in Windows 7 or in Windows Vista from Control Panel
https://technet.microsoft.com/en-us/library/bb397374(v=exchg.80).aspx Install the IIS 6.0 Management ...
- js数组与字符串的相互转换方法 数组常用的方法
1 数组转字符串 需要将数组元素用某个字符连接成字符串,示例代码如下: var a, b; a = new Array(0,1,2,3,4); b = a.join("-"); 二 ...