2955: A改错题--销售部的打印机

时间限制: 1 Sec  内存限制: 128 MB

提交: 61  解决: 47

题目描述

销售部新进了一台快速打印机,使用频率很高。为了能够对打印情况进行统计,规定每个人在打印后需要登记时间和用纸张数。

注:本题只需要提交修改和完善部分的代码,请按照C++方式提交。

#include <iostream>

using namespace std;

class FastPrinter

{

public:

    FastPrinter() {}

    FastPrinter(int year,int month,int day,int num);

    ~FastPrinter() {}

    void PrintJob() {}

    static unsigned int getcounts()

    {

        return counts;

    }

    static unsigned int gettotals()

    {

        return totals;

    }

private:

    static unsigned int counts;

    static unsigned int totals;

    int year,month,day;

};

/* 修改和完善该部分代码

unsigned int FastPrinter::counts = 0;

FastPrinter::FastPrinter(int year,int month,int day,int num):year(year),month(month),day(day)

{

    totals++;

}

*/

int main()

{

    FastPrinter *fp;

    int year,month,day,num;

    int n,m;

    cin>>n;

    while(n--)

    {

        cin>>m;

        while(m--)

        {

            cin>>year>>month>>day>>num;

            fp=new FastPrinter(year,month,day,num);

            fp->PrintJob();

            delete fp;

        }

    }

    cout<<"打印次数:"<<FastPrinter::getcounts()<<",张数:"<<FastPrinter::gettotals()<<endl;

    return 0;

}

输入

第一行n表示下面n个部门

第二行开始分别为每个部门的数据

对于每个部门,

    第一行m表示该部门打印的次数

    接来下m行给出打印的时间(年月日)和打印张数

输出

总的打印次数和打印张数

样例输入

3
2
2015 5 30 98
2015 6 2 128
4
2015 5 29 120
2015 6 1 1000
2015 6 3 45
2015 6 7 300
1
2015 6 3 78

样例输出

打印次数:7,张数:1769

你  离  开  了  ,  我  的  世  界  里  只  剩  下  雨  。  。  。

#include <iostream>
using namespace std;
class FastPrinter
{
public:
FastPrinter() {}
FastPrinter(int year,int month,int day,int num);
~FastPrinter() {}
void PrintJob() {}
static unsigned int getcounts()
{
return counts;
}
static unsigned int gettotals()
{
return totals;
}
private:
static unsigned int counts;
static unsigned int totals;
int year,month,day;
};
unsigned int FastPrinter::counts = 0;
unsigned int FastPrinter::totals = 0;
FastPrinter::FastPrinter(int year,int month,int day,int num):year(year),month(month),day(day)
{
FastPrinter::counts++;
FastPrinter::totals+=num;
}
int main()
{
FastPrinter *fp;
int year,month,day,num;
int n,m;
cin>>n;
while(n--)
{
cin>>m;
while(m--)
{
cin>>year>>month>>day>>num;
fp=new FastPrinter(year,month,day,num);
fp->PrintJob();
delete fp;
}
}
cout<<"打印次数:"<<FastPrinter::getcounts()<<",张数:"<<FastPrinter::gettotals()<<endl;
return 0;
}

YTU 2955: A改错题--销售部的打印机的更多相关文章

  1. YTU 2610: A改错题--体检情况分析

    2610: A改错题--体检情况分析 时间限制: 1 Sec  内存限制: 128 MB 提交: 233  解决: 161 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方式提交. ...

  2. YTU 2609: A改错题--学生信息的输入和输出

    2609: A改错题--学生信息的输入和输出 时间限制: 1 Sec  内存限制: 128 MB 提交: 238  解决: 157 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方 ...

  3. YTU 2954: A改错题--是虫还是草

    2954: A改错题--是虫还是草 时间限制: 1 Sec  内存限制: 128 MB 提交: 83  解决: 55 题目描述 冬虫夏草为虫体与菌座相连而成,冬天是虫子,夏天却是草.根据类生物(bio ...

  4. YTU 2580: 改错题----修改revert函数

    2580: 改错题----修改revert函数 时间限制: 1 Sec  内存限制: 128 MB 提交: 194  解决: 82 题目描述 修改revert函数,实现输入N个数,顺序倒置后输出 #i ...

  5. YTU 2844: 改错题A-看电影

    2844: 改错题A-看电影 时间限制: 1 Sec  内存限制: 128 MB 提交: 69  解决: 47 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方式提交. 小平家长为 ...

  6. YTU 2838: 改错题AB-装置连接

    2838: 改错题AB-装置连接 时间限制: 1 Sec  内存限制: 128 MB 提交: 81  解决: 49 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方式提交. 有AB ...

  7. YTU 2960: 改错题--小鼠标,你要干什吗?

    2960: 改错题--小鼠标,你要干什吗? 时间限制: 1 Sec  内存限制: 128 MB 提交: 118  解决: 62 题目描述 鼠标双击不同的图标产生不同的效果,比如双击文档(documen ...

  8. YTU 2639: 改错题:类中私有成员的访问

    2639: 改错题:类中私有成员的访问 时间限制: 1 Sec  内存限制: 128 MB 提交: 431  解决: 297 题目描述 /* 改错题: 设计一个日期类和时间类,并编写全局函数displ ...

  9. YTU 2622: B 虚拟继承(虚基类)-沙发床(改错题)

    2622: B 虚拟继承(虚基类)-沙发床(改错题) 时间限制: 1 Sec  内存限制: 128 MB 提交: 487  解决: 393 题目描述 有一种特殊的床,既能当床(Bed)用又能当沙发(S ...

随机推荐

  1. JavaScript中离线应用和客户端存储(cookies、sessionStorage、localStorage)

    一.离线应用 所谓离线web应用,就是在设备不能上网的情况下仍然可以运行的应用. 开发离线web应用需要几个步骤:首先,确保应用知道设备是否能上网,以便下一步执行正确的操作:然后,应用还必须能访问一定 ...

  2. Java学习之接口概念

    Java语言只支持单重继承,不支持多继承,即一个类只能有一个父类.但是在实际应用中,又经常需要使用多继承来解决问题.为了解决该问题,Java语言提供接口来实现类的多继承问题. 接口(英文interfa ...

  3. 比较spring cloud和dubbo,各自的优缺点是什么

    dubbo由于是二进制的传输,占用带宽会更少springCloud是http协议传输,带宽会比较多,同时使用http协议一般会使用JSON报文,消耗会更大 dubbo的开发难度较大,原因是dubbo的 ...

  4. hust训练赛20160330--B - 又见LKity

    Problem 2122 又见LKity Time Limit: 1000 mSec Memory Limit : 32768 KB  Problem Description 嗨!大家好,在Templ ...

  5. python学习笔记--python数据类型

    一.整形和浮点型 整形也就是整数类型(int)的,在python3中都是int类型,没有什么long类型的,比如说存年龄.工资.成绩等等这样的数据就可以用int类型,有正整数.负整数和0,浮点型的也就 ...

  6. POJ1450:Gridland 【杂题】

    题目大意:先给出了TSP的背景,然后给出一个n*m的单位格点的图,图中除边缘上的点与八个方向的点有边连接,距离为欧拉距离,求从左上角出发的TSP 思路:从水题列表中看到的题,但看一开始给出的backg ...

  7. 【字符串+BFS】Problem 7. James Bond

    https://www.bnuoj.com/v3/external/gym/101241.pdf [题意] 给定n个字符串,大小写敏感 定义一个操作:选择任意m个串首尾相连组成一个新串 问是否存在一个 ...

  8. 外星联络(bzoj 2251)

    Description 小 P 在看过电影<超时空接触>(Contact)之后被深深的打动,决心致力于寻找外星人的事业.于是,他每天晚上都爬在屋顶上试图用自己的收音机收听外星人发来的信息. ...

  9. solr请求处理器列表

    List of Request Handlers Available The Javadocs contain a complete list of Request Handlers. Many of ...

  10. I NEED A OFFER!---hdu1203(01背包)

     http://acm.hdu.edu.cn/showproblem.php?pid=1203   Problem Description Speakless很早就想出国,现在他已经考完了所有需要的考 ...