# LP Decision-Making

Source: Internet
Author: User

Question:

Problem description many of you are fascinated by LOL and are running on the machine room every day. It is known that the fee for data centers is 1 RMB/hour (less than one hour is calculated as one hour ). The boss LP of the data center has launched a special preferential solution (which is harmless) as long as the actual total time of the data center within one day (that is, the actual time on the computer) exceeds 5 hours, it will automatically recharge 1 RMB in its account. It is known that each user's initial account is 50 RMB ..
Now you need to know the account information after each host is completed in one day. (Class required)
Input contains multiple groups of test data. The first behavior account information (student ID (no more than 15 digits) and name (no more than 20 digits) of each group are displayed )). The second behavior is an integer n. Indicates the number of computers on a daily basis. Next there are n rows, each of which includes the time (hours: minutes) for each on/off operation ). Output the account information after each disconnection: Student ID, name, cost on the machine, and balance after the machine is down. Output 10 "*" after each group of data is complete "*". (For the specific format, see the output sample.) sample input
`123456 Linping48:30 11:2512:47 14:2016:10 18:1019:00 22:00`
Sample output
`ID:123456 Name:Linping Cost:3 Account:47ID:123456 Name:Linping Cost:2 Account:45ID:123456 Name:Linping Cost:2 Account:44ID:123456 Name:Linping Cost:3 Account:41**********`

Reference code:

`#include <iostream>#include <string>using namespace std;class LoL{    private:    string id;    string name;    int y;    public:    LoL(string a, string b) {        id = a;        name = b;        y = 50;    }    void print(int t, int k) {        cout << "ID:" << id << " Name:" << name << " Cost:";        y = y - t;        y = y + k;        cout << t << " Account:" << y << endl;    }    };int main(){    //freopen("1.txt","r",stdin);    string a;    string b;    while (cin >> a >> b) {        int p;        cin >> p;        int m, n, c, d;        char a1, a2;        LoL w(a, b);        int t = 0;        int t1 = 0;        int k = 0;        while (p--) {            k = 0;            cin >> m >> a1 >> n >> c >> a2 >> d;            t = c - m;            if (d > n)                t++;            t1 = t1 + ((c - m) * 60 + d - n);            if (t1 >= 300) {                t1 = t1 % 300;                k = 1;            }            w.print(t, k);        }        cout << "**********" << endl;    }    return 0;} `

Related Keywords:

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.