2016 Group design Ladder race-preliminary

Source: Internet
Author: User

There is a listing here ↑

3h only AC l1-1 ~ l1-8, l2-1 ~ l2-3, l3-2

L3-1 is nearly finished, or the hand is too slow.

L2-4 (Keng Gen forgot how to write ...) "Finished" and l3-3 don't have time to read it.

Match website: https://www.patest.cn/contests/2016gplt-1

Address: HTTPS://WWW.PATEST.CN/CONTESTS/GPLT


l1-1. In the end there are more than two (analog) time limit MS
Memory Limit 65536 KB
Code length limit 8000 B
Standard author Chen Yue The procedure of the sentence

An integer "degree of two" is defined as the ratio of the number containing 2 to the number of digits. If the number is negative, the degree increases by 0.5 times times, or 1 time times if it is even. For example, the number "-13142223336" is a 11-digit number, which has 3 2, and is negative and even, its two degree is calculated as: 3/11*1.5*2*100%, about 81.82%. You can calculate the number of a given integer by two.

Input Format:

Enter the first row for an integer n that is no more than 50 digits.

output Format:

In a row of the output of N offense two degree, keep the decimal point after two digits. Input Sample:

-13142223336
Output Sample:
81.82%
Count 2 According to the question and determine if it is a negative number or even.

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int Len;
Char s[55];
Double ans,num1,num2;

int main () {
    while (1==scanf ("%s", s)) {
        num1=num2=1;
        Len=strlen (s);
        ans=0;
        for (int i=0;i<len;++i) {
            if (s[i]== '-') {
                num1=1.5;
            }
            else if (s[i]== ' 2 ') {
                ans+=1
            }
        }
        if (s[len-1]== ' 0 ' | | s[len-1]== ' 2 ' | | s[len-1]== ' 4 ' | | s[len-1]== ' 6 ' | | s[len-1]== ' 8 ') {
            num2=2;
        }
        if (s[0]== '-') {
            --len
        }
        printf ("%.2lf%%\n", 100*ans/len*num1*num2);
    }
    return 0;
}

l1-2. Big Ben (analog) time limit MS
Memory Limit 65536 KB
Code length limit 8000 B
Standard author Chen Yue The procedure of the sentence

Weibo has a self-proclaimed "Big Ben V" of the guy, every day to urge the yard farmers cherish the body early to sleep. But because the stupid clock is not very regular, so ringing clock is not timed. Generally, the number of bells is based on the time of the bell, if it happens to knock on the whole point, then the "when" is equal to the number of the whole hour; If you cross the whole point, knock down the next hour. In addition, although 24 hours a day, the clock is only in the second half a day after knocking 1~12. For example, to ring the bell at 23:00 is to "be when you are when you are a", and at 23:01 it will be "when you are, when you are when you are when you are when you are". At midnight 00:00 to 12:00 noon (the end time included), the stupid clock is not knocking.

Below, please write a program, according to the current time for Big Ben Bell.

Input Format:

Enter the first line to give the current time in "hh:mm" format. of which HH is an hour, between 00 and 23; mm is minutes, between 00 and 59.

output Format:

According to the current time for Big Ben Bell, that is, in one line output the corresponding number of "Dang." If the clock is not ringing, the output:

Only hh:mm.  Too early to Dang.

where "hh:mm" is the input time. Enter Sample 1:

19:05
Output Sample 1:
Dangdangdangdangdangdangdangdang
Enter Sample 2:
07:05
Output Sample 2:
Only 07:05.  Too early to Dang.

According to the question request to judge can

If hh<12| | (hh==12&&mm==0), do not ring the bell, note that you need format output

Otherwise, if mm==0, output hh-12 secondary dang, if mm!=0, output hh-11 times dang

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int h,m;

int main () {
    while (2==scanf ("%d:%d", &h,&m)) {
        if (h<12| | (h==12&&m==0)) {
            printf ("Only%02d:%02d.  ") Too early to dang.\n ", h,m);
        }
        else {
            h-=12;
            if (m!=0) {
                ++h;
            }
            while (h-->0) {
                printf ("Dang");
            }
            printf ("\ n")
        ;
    }
    return 0;
}

L1-3. Who first to reverse time limit ms
Memory Limit 65536 KB
Code length limit 8000 B
Standard author Chen Yue The procedure of the sentence

Huaquan is an interesting part of the ancient Chinese wine culture. On the wine table two people Huaquan method is: Each mouth shout out a number, at the same time with hand gestures out a number. If someone is equal to the number of figures that two people shout out, who loses, the loser punishes a glass of wine. Two people win or two lose together, continue the next round until the only winner appears.

The following gives a, b two people's alcohol (maximum can drink how many cups do not pour) and Huaquan Records, please judge two people who fell first.

Input Format:

Enter the first row gives a, b two people's alcohol (not more than 100 of nonnegative integers), separated by a space. The next line gives a positive integer n (<=100), followed by n rows, and each row gives a round of Huaquan records, in the form:

A shout a row B shout B row

The "shout" is the number of shouted out, "Row" is the number of figures, are not more than 100 positive integers (two hands together).

output Format:

In the first line of the output first fall of the person: a represents a, B for B. The number of cups of the person who did not fall in the second line. The title guaranteed a man to fall. Note that the program is processed to terminate when someone falls, and the following data does not have to be processed. Input Sample:

1 1
6
8 9 5
5 3 8
5 1 (4 15 1)
Output Sample:
A
1

Directly judge each win or lose, if someone falls, then read the data no longer judge win or lose, need to pay attention must be one person to win, and the other lose, people will drink


 #include <cstdio> #include <cstring> #include <algorithm> using namespace std;
int loseea,loseeb,n;
int pa,sa,pb,sb,cnta,cntb,cups;

Char lose;
        int main () {while (2==scanf ("%d%d", &loseea,&loseeb)) {lose= ';
        cnta=cntb=0;
        scanf ("%d", &n);
            while (n-->0) {scanf ("%d%d%d%d", &PA,&SA,&PB,&SB);
                    if (lose== ' ") {if (SA==PA+PB&&SB!=PA+PB) {++cnta;
                        if (CNTA>LOSEEA) {lose= ' A ';
                    CUPS=CNTB;
                    } else if (SA!=PA+PB&&SB==PA+PB) {++cntb;
                        if (Cntb>loseeb) {lose= ' B ';
                    Cups=cnta;
    }} printf ("%c\n%d\n", lose,cups);
return 0; }


l1-4. Handsome to have no friends (Mark) time limit MS
Memory Limit 65536 KB
Code length limit 8000 B
Standard author Chen Yue The procedure of the sentence

There are always people who are too handsome to have friends when they are busy sending photos in their circle of friends. The subject requires you to find those who are handsome and have no friends.

Input Format:

Enter the first row to give a positive integer n (<=100), is the number of known circle of Friends, then n rows, each row first gives a positive integer k (<=1000), the number of friends in the circle, and then lists a friend in the circle of everyone-for convenience, each corresponding to an ID number, 5 digits (from 00000 to 99999), separated by a space between IDs, a positive integer m (<=10000) is given, and the number of people to be queried is listed in the next row, with a space separated by the ID of the m to be queried.

Note: People without friends can be simply not installed "circle of Friends", can also be only a person in the circle of friends. Although there are individual narcissists who will put themselves back and forth into the circle of friends, the title guarantees that there are at least 2 different people in the circle of friends who have more than 1 K.

output Format:

Output in the order of input those who are handsome to have no friends. The IDs are separated by 1 spaces, and there must be no extra spaces between the lines. If nobody is too handsome, output "no one is handsome".

Note: The same person can be queried multiple times, but only one output at a time. Enter Sample 1:

3
3 11111 22222 55555
2 33333 44444
4 55555 66666
99999 77777 8 55555 44444 10000 88888
22222 11111 23 333 88888
Output Sample 1:
10000 88888 23333
Enter Sample 2:
3
3 11111 22222 55555
2 33333 44444
4 55555 66666
99999 77777 4 55555 44444 22222 11111

Output Sample 2:
No one is handsome

Directly using a bool array to mark whether a person is in a circle of friends, only need to pay attention to the circle of friends only one person does not mark

Query, and then use the BOOL array to mark whether the person has been queried, no query to save the array, and finally in accordance with the total number of formatted output can be

Note: Output people need to output 5 digits, that is, including a leading 0, check for a long time to find, or there will be a moment

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.