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. django1.11 启动错误:Generator expression must be parenthesized

    错误信息: Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0 ...

  2. HDU 5468 Puzzled Elena

    Puzzled Elena Time Limit: 2500ms Memory Limit: 131072KB This problem will be judged on HDU. Original ...

  3. 服务器安装oracle前的内存调整

    #当前内存大小为512MB,安装oracle时执行检查... Checking physical memory requirements ... Expected result: 922MB Actu ...

  4. bzoj 2337 高斯消元+概率DP

    题目大意: 每条路径上有一个距离值,从1走到N可以得到一个所有经过路径的异或和,求这个异或和的数学期望 这道题直接去求数学期望的DP会导致很难列出多元方程组 我们可以考虑每一个二进制位从1走到N的平均 ...

  5. POJ1780 Code

    KEY公司开发出一种新的保险箱.要打开保险箱,不需要钥匙,但需要输入一个正确的.由n位数字组成的编码.这种保险箱有几种类型,从给小孩子玩的玩具(2位数字编码)到军用型的保险箱(6位数字编码).当正确地 ...

  6. 【三分+精度问题】G. Toxophily

    https://www.bnuoj.com/v3/contest_show.php?cid=9154#problem/G [题意] 已知人的坐标在(0,0),靶的位置在(x,y),人以速度v射箭并且射 ...

  7. vue验证码点击更新

    vue验证码点击更新 不说啥,直接贴代码 html: <img class="captcha" @click="editCaptcha" :src=&qu ...

  8. Java线程的5种状态及切换(透彻讲解)

    http://blog.csdn.net/pange1991/article/details/53860651

  9. ACM-ICPC 2018 南京赛区网络预赛 L && BZOJ 2763 分层最短路

    https://nanti.jisuanke.com/t/31001 题意 可以把k条边的权值变为0,求s到t的最短路 解析  分层最短路  我们建立k+1层图 层与层之间边权为0,i 向 i+1层转 ...

  10. PAT (Advanced Level) 1034. Head of a Gang (30)

    简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...