Title Description
We all know that Flappy Bird, for the birds everywhere jumping dead, V8 said, so he became a flying species, in order to show respect for birds I don't say he is a bird. V8 during the flight, each click on the screen will fly up a unit, and is an instant rise (he why so I do not know), that is, t seconds when the height has risen, and do not click on the screen will naturally drop a unit, the way ibid. This and Flappy Bird oblique diagonal is not the same, to note.
V8 flight speed is horizontal 1 units/second, and here are some pillars that tell you the distance from the bottom of the hanging pillar and the distance from the starting point, all the pillars are hanging, the diameter of the pillars is negligible. Now give you a sequence of operations, one operation per second, 0 means no operation, 1 for tapping the screen, if the V8 hit the pillar or fell to the buttocks, the output hangs off the time t, if he smoothly through the level, output "V8orz".
Input
Multiple sets of input and output
The first line is a t that represents the number of groups of data.
Then for each set of data, the first line is an integer n (n<1001), which represents the length of the time series.
The second line has a 0/1 sequence of n numbers, representing the sequence of operations.
The third line is an integer m (m<=n) that represents the number of columns.
The four lines have m integers, and the number I indicates the height of the bottom of the pillar I is from the ground.
The second row has m integers, and the number of I represents the position of the column I, which corresponds to the time series and coordinates starting from 0 .
Line Six has an integer h representing the initial height of the V8, starting at 0 .
Ensure that all data is less than Int_max.
Output
Each row of data output, if successfully through the level, output "V8orz", otherwise the output V8 time.
--The text looks very complex, in fact, very water, data range is particularly small every step to check whether the current height is legal is good
#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cstdlib>#include<vector>using namespaceStd;typedefLong LongLL;#defineSIZE 1002intOrder[size];intheight;structzhunode{intTime ; intHeight;};structZhunode zhuzi[size];intMaxheight[size];intn,m;voidGameintsec) { if(Order[sec] = =0) {Height--; } Else{Height++; } if(Height <=0|| Height >=Maxheight[sec]) {printf ("%d\n", SEC); return; } Else { if(sec+1==N) {printf ("v8orz\n"); } Else{Game (sec+1); return; } }}intMain () {inttime,t; scanf ("%d",&T); for(time=1; time<=t;time++) {scanf ("%d",&N); inti,j; for(i=0; i<n;i++) {scanf ("%d",&Order[i]); } memset (MaxHeight,0x3f,sizeof(MaxHeight)); scanf ("%d",&m); for(i=0; i<m;i++) {scanf ("%d",&Zhuzi[i]. Height); } for(i=0; i<m;i++) {scanf ("%d",&Zhuzi[i]. Time); Maxheight[zhuzi[i]. TIME]=Zhuzi[i]. Height; } scanf ("%d",&height); Game (0); } return 0;}
Xidianoj 1086 Flappy V8