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. prototype 和function关系等总结

    js提供了一些内置类,如Array String Function等,只要有类就有原型. 1,function ,属性包括 arguments, caller,length,name ,prototy ...

  2. POJ 1904:King's Quest【tarjan】

    题目大意:给出一个二分图的完美匹配(王子和公主的烧死名单表),二分图x部和y部均只有n个点,问对于每一个x部的点,他能选择哪些点与之匹配 使得与之匹配后,剩余图的最大匹配仍然是n 思路:这题是大白书3 ...

  3. SQL Prompt 5.1使用

    SQL Prompt 5.1教程 1.下载 自行下载安装文件.本人是从http://www.cr173.com/下载的. 2.安装 安装没什么特别的,不用说了 3.注意一下破解和配置 按里面的read ...

  4. 时间戳转换成DateTime

    select DateAdd(hour,8,Dateadd(ss,时间戳,'1970-01-01'))   --1970/01/01+时间戳(秒数)+8小时 --因GMT是中央时区,北京在东8区,相差 ...

  5. 2887 Big String

    splay瞎搞一下,正解是分块数组或分块链表,但是学不会啊! #include<cstdio> #include<cstdlib> #include<iostream&g ...

  6. [Bzoj2039]小Z的袜子 (莫队算法模板题)

    2038: [2009国家集训队]小Z的袜子(hose) Time Limit: 20 Sec  Memory Limit: 259 MBSubmit: 11866  Solved: 5318[Sub ...

  7. Ubuntu 16.04安装双显卡驱动方法收集

    说明:不一定有效,要不断尝试. http://www.linuxwang.com/html/2150.html http://blog.csdn.net/feishicheng/article/det ...

  8. rror Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnec

    在mysql5中,可以设置safe mode,比如在一个更新语句中 UPDATE table_name SET bDeleted=0; 执行时会错误,报: You are using safe upd ...

  9. easyui combotree选项重复

    现象 编辑,赋值出现重复选项 原因 值之间有空格,比如我取值是3, 4, 6要改成3,4,6 注意:数值之间的空格去掉了

  10. Myeclipse配置jad

    下载地址:http://pan.baidu.com/s/1bnpMEuF 1.下载jad158g.win.zip 下载后解压.解压缩后将jad.exe拷贝到自定义的文件夹内:我这里用的是D:/jad/ ...