008 - Luo Gushun sequence algorithm notes and training branch

(Baotoushucuan) my my ... I know I should not do the water problem should learn ...

But being bored force against the buckle woke up after severely ... I really do not understand the power button to see the parameter transfer are some Gesha ...

anyway the focus is to look at water problems are p1422 p1085 p1089 p1909

Title Description

Summer, and each household's electricity consumption have increased a lot, the corresponding electricity also post more. Xiaoyu home today received a notice electricity. Xiaoyu see written above: According to Min valence requirements [2006] No. 27, and monthly electricity consumption 150 kwh per kWh 0.4463 yuan the following sections performed monthly electricity consumption in some 151 to 400 kilowatt-hours per kWh 0.4663 yuan execution, the monthly electricity consumption 401 kwh and more parts per kWh 0.5663 yuan execution; Xiaoyu want to test themselves, the number of tariff on electricity bills payable notice in the end it is correct. Write a program, known total electricity, according to price regulations, payable calculated electricity should be.

Input Format

An integer that indicates the total power (in units of kilowatt hours), not more than 10,000.

Output Format

(1 unit in the dollars, reserved to the decimal point) after the output of a number, a decimal retained.

Sample input and output

Input # 1
267
Output # 1
121.5

Title Description

Jinjin the junior high school. Her mother felt Jinjin should study harder, so Jinjin in addition to school, but also for her mother to participate in the registration of subjects refresher course. Also weekly mother would send her to learn reading, dance and piano. But if Jinjin day of classes over eight hours will be unhappy, but also on the longer it will be more unhappy. Jinjin will not assume other things unhappy, and she's not happy not last until the next day. Would you please check Jinjin schedule next week, next week, she will not be unhappy to see; and if so, the most unhappy day.

Input Format

Inputs include 77 7-line, respectively schedule Monday to Sunday. Each row comprises two less than 1010 . 1 non-negative integer of 0, separated by spaces, respectively, and mother Jinjin time arrangements in her school class time.

Output Format

A number. If the output does not upset 00 0 if the output will be the most unhappy of the week (by 1,2,3,4,5,6,71, 2, 3, 4, 5, 6, 7 . 1 , 2 , 3 , 4 , 5 , 6 , 7 respectively, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday). If there are two or more days degree quite unhappy, the output time of the most forward of the day.

Sample input and output

Input # 1
5 3
6 2
7 2
5 3
5 4
0 4
0 6
Output # 1
3

Title Description

Jinjin pocket money has always been its own management. Beginning of each month to the mother Jinjin 300300, China 3 0 0 dollars, Jinjin would be spending budget this month, and always do the same actual spending and budget.

In order to learn how to save Jinjin, my mother suggested that the presence of Jinjin can always put her money where hundreds whole, to the end of the year she will add 20% 20 \% 2 0 % return Jinjin. Therefore Jinjin develop a savings plan: beginning of each month, after spending money to get the mother, if she is expected to end in the hands of this month there will be more than 100100 1 0 0 yuan or just 100100 1 0 $ 0, she will put her mother there exist hundreds of full money, the rest of the money in their hands.

For example 1111 1 early January Jinjin hands as well as 8383 8 $ 3, my mother gave Jinjin 300300, China 3 0 0. Jinjin expected 1111 1 January spending is 180180 1 8 0 yuan, then she will keep her mother where 200200 2 0 $ 0, leaving himself 183 183 1 8 3 yuan. To 1111 1 at the end of January, it will be left in the hands of Jinjin 33 3 dollars.

The main risk Jinjin found that the savings plan is that the presence of the mother where the money can not be withdrawn before the end of the year. There may be at the beginning of a month, Jinjin their money plus the money this month to the mother, not the original budget this month. If this happens, Jinjin this month will have to live frugally, compression budget.

Now you based on January 2004 to December Jinjin budget each month, the judge will not happen. If after not calculated to the end of 2004, my mother would Jinjin usual deposit money back plus 20% of the Jin-Jin, Jin-Jin hands will have much money.

Input Format

1212 . 1 2 lines of data, each row containing a less than 350.35 thousand . 3 . 5 non-negative integer of 0, respectively . 11 January 1212 . 1 2 dated Jinjin budget.

Output Format

An integer. The situation appeared a month short of money during the savings plan, if implemented, output -XX - the X-, XX the X-represents the emergence of the first month of this situation; otherwise the output to 20,042,004 2 0 0 4 How many hands Jinjin end of Year money.

Note, Los valley does not require file input and output, but the standard input and output.

Sample input and output

Input # 1
290
230
280
200
300
170
340
50 
90 
80 
200
60 
Output # 1
-7 

Title Description

P n Teachers need to go to the store to buy pencils as children participate NOIP gift. She found the store a total of 33 three kinds of packaging pencil, pencil in a number of different packaging may be different, prices may vary. To be fair, P teacher decided to only buy the same package of pencils.

Shops are not allowed to open pencil packaging, so P teacher may need to buy more than nn the n-pencil is enough for the children to send gifts.

Now P teacher wanted to know, in each store the number of packages are sufficient, at least enough to buy nn the n-pencil least need to spend much money.

Input Format

The first line contains a positive integer NN n-, represents the number of pencil required.

The next three rows, with each row 22 is two positive integers a packaged pencil described: wherein first . 11 a represents an integer number of such packages within the pencil, the first 22 is 2 Prices integer such packages.

To ensure that all of the 77 7 digits is no more than 1.00001 billion . 1 0 0 0 a positive integer including 0.

Output Format

11 an integer representing the money it takes at least P teacher.

Sample input and output

Input # 1
57
2 2
50 30
30 27
Output # 1
54
Input # 2
9998
128 233
128 2333
128 666
Output # 2
18407
Input # 3
9999
101 1111
1 9999
1111 9999
Output # 3
89991

 #include <cstdio>
int main()
{
    int n;
    scanf("%d",&n);
    if(n <= 150)
        printf("%.1f",(float)n*0.4463);
    else
    {
        if(n <= 400)
        printf("%.1f",(float)(n-150)*0.4663+150*0.4463);
        else
            printf("%.1f",(float)(n-400)*0.5663+250*0.4663+150*0.4463);
    }
    return 0;
}
(Xiaoyu home electricity)

#include <cstdio>
int main()
{
    int a[2][8],j = 1;
    for(int i = 1; i <= 7; i++)
    {
        scanf("%d%d",&a[0][i],&a[1][i]);
        if(j)
        {
            if(a[0][i]+a[1][i] > 8)
            {
                printf("%d\n",i);
                j--;
            }
        }
    }
    return 0;
}
(Unhappy Jinjin)

#include <cstdio>
int main()
{
    int sum = 0,m,t = 1,k = 0;
    for(int i = 1; i <= 12; i++)
    {
        scanf("%d",&m);
        sum += 300 - m;
        if(t)
        {
            if(sum < 0)
            {
                printf("-%d\n",i);
                t--;
            }
        }
        k += sum/100;
        sum %= 100;
    }
    if(t)
    {
        printf("%d",sum+120*k);
    }
    return 0;
}
(Jinjin savings plan)

#include <cstdio>
int main()
{
    int n,quantity,price;
    int minsum = 2147483647,sum;
    scanf("%d",&n);
    for(int i = 0; i < 3; i++)
    {
        scanf("%d%d",&quantity,&price);
        sum = price*((n+quantity-1)/quantity);
        if(minsum > sum)
            minsum = sum;
    }
    printf("%d",minsum);
    return 0;
}
(Buy pencils)

Guess you like

Origin www.cnblogs.com/jun-ruo-sui-nian/p/suijun_008.html