The test race of Garlic Road

Source: Internet
Author: User

Topic Links: HTTP://WWW.JISUANKE.COM/MINICOURSE/63

Green energy

Garlic is changing the world again. This time he will design solar power solutions for some of the worst terrain conditions.

In the latest design, the solar panels are set on some solar towers, which are high with the tower.

This time, there will be N solar Towers set up, these towers have been made in advance, where the tower i is HI, and now the engineer needs to determine where to place the tower in order to obtain the maximum total energy.

The terrain environment where the solar tower is placed is represented by a polygon of M points. Each point of the polygon will give the corresponding coordinates (xi, yi), xi < xi+1.

After measurement, the sun's angle of exposure here is constant α. The Sun's sun shines in the upper-left corner to the lower-right corner of the area. The amount of solar energy obtained depends on the length of the tower being irradiated by the sun.

When the two towers are placed nearer, the shadow of the tower on the left falls on the right tower, so that the power on the right side of the tower will be reduced to a certain extent. In the same vein, the surrounding undulating terrain will have some shade on the solar tower, thus reducing the energy gained.

Your task is to design a solar tower placement scheme that allows all solar towers to get as much energy as possible.

Input

The first line of the input file contains three integers n, m,α (1≤n≤104, 2≤m≤104, 1≤α< 90).

The second line contains n integers hi, which is the height of the tower (1≤hi ≤103).

The next m behavioris xi,y I pair, which is the vertex coordinates of the terrain (|xi|≤105, xI < xi+1, |yi|≤103).

Output

The first behavior of the output file is the maximum possible solar energy value, and the absolute error does not exceed6.

The next n line outputs the x-coordinate of the location of the solar tower, and the absolute error does not exceed9.

The output order of the coordinates of the solar tower should be consistent with the input order.

If there are many schemes that make the total energy value the most, the output can be any one.

Example 1

Input:

5 4 1020 10 20 15 100 1040 2050 070 30

Output:

52.34288864959254516.00.070.065.365.3

Every math problem is a bit of a hassle. Have time to write again;

Reprint please specify the Source: Search & Star Children

Knockout car

The racing race has become more and more popular in Pandora. But their game is not the same as our usual: N-Cars compete on a long straight track. The speed of each car is 1m/s, and the entire track is marked with coordinates at every metre.

In racing cars, I moved from ai to b i from 0 seconds onwards. After reachingb I, I move back from BI to ai . Cycle.

Another garlic fungus! Originally this is the garlic fungus is playing a mobile phone game. Garlic fungus can put down TNT in some places to blow up some cars. Because he has a m problem. The question J is: how many cars are there in the TJ momentbetween x i and yI?

Your task is to answer the question of Meng garlic.

Input

The first line of input contains two numbers n and M (1≤n, m≤1000), respectively, representing the number of racing cars and the number of garlic problems in the race.

In the next n rows, each row contains 2 integers ai, Bi (0≤ai, bi ≤109, a i ! = bi), respectively, representing the start and end of the racing I.

In the next M row, each row contains 3 integers xj,yj,tj (0≤xj   ≤yj   ≤109, 0≤tj   ≤109", respectively, represents the left and right coordinate boundaries of question J and the time of inquiry.

Output

The output has a total of m rows, each with an integer representing the answer to the corresponding m question.

Example 1

Input:

5 50 10 22 33 54 50 5 00 1 20 2 12 5 22 5 3

Output:

51243

Figure out the position of each state (point in time) the car stops (note the starting direction)

Reprint please specify the Source: Search & Star Children

#include <stdio.h> #define LL long longstruct car{ll A; LL b;} NUM[1005];    ll Ffabs (ll x) {if (x<0) return-x; else return x;}    int main () {LL n,m;    LL x,y,t;    scanf ("%lld%lld", &n,&m);    for (int i=0; i<n; i++) {scanf ("%lld%lld", &num[i].a,&num[i].b);        } for (int i=0; i<m; i++) {scanf ("%lld%lld%lld", &x,&y,&t);        LL ca=0; for (int j=0; j<n; J + +) {if (num[j].a<num[j].b) {if (num[j].a>y| |                NUM[J].B&LT;X) continue;                    if (num[j].a>=x&&num[j].b<=y) {ca++;                Continue                    } else {LL sum=-1;                    if (t==0) {sum=num[j].a;            } else if (t<=num[j].b-num[j].a) {sum=num[j].a+t;        } else {LL s=t/ffabs (NUM[J].B-NUM[J].A);                        LL Tp=t%ffabs (NUM[J].B-NUM[J].A);     if (s%2==0) {sum=num[j].a+tp;                        if (tp==0) sum=num[j].b;      } else {sum=num[j].b-tp;                        if (tp==0) sum=num[j].a;                }} if (Sum>=x&&sum<=y) ca++; }} else {if (num[j].a<x| |                Num[j].b>y) continue;                    if (num[j].b>=x&&num[j].a<=y) {ca++;                Continue                    } else {LL sum=-1;                      if (t==0) {  SUM=NUM[J].A;                    } else if (T<=ffabs (num[j].a-num[j].b)) {sum=num[j].a-t;                        } else {LL s=t/ffabs (NUM[J].B-NUM[J].A);                        LL Tp=t%ffabs (NUM[J].B-NUM[J].A);  if (s%2==0) {sum=num[j].a-tp;                        if (tp==0) sum=num[j].b;  } else {sum=num[j].b+tp;                        if (tp==0) sum=num[j].a;                }} if (Sum>=x&&sum<=y) ca++;    }}} printf ("%lld\n", CA); } return 0;}


Substitution of jokes

The little garlic is naughty again. This time, my sister's experiment report was brutally poisoned.

My sister's experiment report originally recorded a sequence from 1 to N, with any two-digit space between them. But the "pit elder sister" of the garlic incredibly the space between the numbers are deleted, the entire number of the sequence into a length of 1 to 100, and the first no space number string.

Now the sister has been angry, garlic to find you write a program to quickly restore the experimental data.

Input

The input file has a line that is a string-the experimental data that was messed up by the garlic.

The length of the string is between 1 and 100.

Output

Output a total of one row for the sister's original test data--1 to n output.

There is a space between any of the two data.

If you have more than one set of correct solutions to meet the requirements, you can output any one of them.

Example 1

Input:

4111109876532

Output:

4 1 11 10 9 8 7 6 5 3 2

Idea: Deep search, skill according to the length of the string first to find the maximum value, first search two digits;

Reprint please specify the Source: Search & Star Children

#include <stdio.h> #include <string.h>char ch[105];bool vc[105];bool vis[105];int num[105];int mmax;int len    ; bool Flag=false;int ttt=0;void dfs (int k,int t) {if (flag) return;    Num[t]=k;    int tt=ch[k]-' 0 ';        if (k+1<len) {int tp= (ch[k]-' 0 ') *10+ch[k+1]-' 0 ';             if (Tp<=mmax&&!vis[tp]&&!vc[k]&&!vc[k+1]) {//printf ("--------------------\ n");            Vis[tp]=true;            Vc[k]=true;            Vc[k+1]=true;            DFS (K+2,T+1);            Vis[tp]=false;            Vc[k]=false;        Vc[k+1]=false;    } if (T==mmax&&k>=len) {flag=true; return;}        } if (!vis[tt]&&!vc[k]&&tt<=mmax&&k<len) {vis[tt]=true;        Vc[k]=true;        DFS (K+1,T+1);        Vis[tt]=false;    Vc[k]=false; } if (T==mmax&&k>=len) {flag=true; return;}}    int main () {scanf ("%s", ch);    Len=strlen (CH);    if (len<10) Mmax=len; else {MMAx=9+ (len-9)/2;    } num[0]=1;    memset (vis,false,sizeof (VIS));    memset (vc,false,sizeof (VC));    DFS (0,0); if (flag) {for (int i=0,j=1; i<len; i++) {if (I==num[j]) {printf (                " ");            j + +;        } printf ("%c", Ch[i]); }} return 0;} /*111108569742311110852974231102345678911*/


Cheating whistle-blowers

In view of the congestion in our city, the municipal traffic control department has been hearing the decision to place automatic parking charge system on both sides of the road. When the vehicle into the parking space, the system will be equipped with a camera to capture the vehicle image, by identifying the number of license plate, the letter sequence to identify the license plate, by connecting the DMV vehicle Information database to confirm the vehicle, the deduction fee.

The play of wits is generally started from here ...

Some owners can avoid the payment of parking fees by blocking one or more numbers and letters on the license plate while stopping the identification of the system.

Car owners This is simply a one-stop to get out a world puzzle has wood?! Management is on the one hand, the technical solution is the kingly ah.

Such a difficult project had to be handed over to the Garlic Guest lab. D God is responsible for identifying the color, E God is responsible for model identification, the possible license plate range is so little reduced. As an intern of garlic is also arduous task, will already exist in the vehicle database can match with the current known information to screen out the license plate information, this is the first step of the whole project AH, the importance I will not say more, come on.

Input

The first line of the input file contains a 9-character sequence of characters that represents the recognition.

The recognizable characters are displayed in uppercase letters and numbers, and "*" denotes characters that are not recognized because they are obscured.

The second line of the input file contains an integer n (1≤n≤1000)-The number of license plate information in the motor vehicle database.

Next n rows, containing the corresponding license plate information, one per line.

The license information is a string of length 9 that contains only numbers and uppercase letters. All license information is guaranteed to be different.

Output

The first behavior of the output file is an integer k (0≤k≤n)-the number of licenses that meet the given requirements.

The next K-line, output all possible license plate information.

Example 1

Input:

A**1mp19*4a001mp199e885ee098a111mp199kt7351ttb

Output:

2a001mp199a111mp199

Violence!

Reprint please specify the Source: Search & Star Children

#include <stdio.h> #include <string.h>char ans[1005][15];int main () {    char tp[15],num[15];    int n,ca=0;    scanf ("%s", num);    scanf ("%d", &n);    while (n--)    {        scanf ("%s", TP);        BOOL Bo=true;        for (int i=0;i<9;i++)        {            if (num[i]== ' * ') continue;            if (Num[i]!=tp[i]) {bo=false;break;}        }        if (bo) {strcpy (ANS[CA++],TP);}    }    printf ("%d\n", CA);    for (int i=0;i<ca;i++)    printf ("%s\n", Ans[i]);    return 0;}


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The test race of Garlic Road

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.