YTU 2955: A改错题--销售部的打印机
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;
}
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改错题--销售部的打印机的更多相关文章
- YTU 2610: A改错题--体检情况分析
2610: A改错题--体检情况分析 时间限制: 1 Sec 内存限制: 128 MB 提交: 233 解决: 161 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方式提交. ...
- YTU 2609: A改错题--学生信息的输入和输出
2609: A改错题--学生信息的输入和输出 时间限制: 1 Sec 内存限制: 128 MB 提交: 238 解决: 157 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方 ...
- YTU 2954: A改错题--是虫还是草
2954: A改错题--是虫还是草 时间限制: 1 Sec 内存限制: 128 MB 提交: 83 解决: 55 题目描述 冬虫夏草为虫体与菌座相连而成,冬天是虫子,夏天却是草.根据类生物(bio ...
- YTU 2580: 改错题----修改revert函数
2580: 改错题----修改revert函数 时间限制: 1 Sec 内存限制: 128 MB 提交: 194 解决: 82 题目描述 修改revert函数,实现输入N个数,顺序倒置后输出 #i ...
- YTU 2844: 改错题A-看电影
2844: 改错题A-看电影 时间限制: 1 Sec 内存限制: 128 MB 提交: 69 解决: 47 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方式提交. 小平家长为 ...
- YTU 2838: 改错题AB-装置连接
2838: 改错题AB-装置连接 时间限制: 1 Sec 内存限制: 128 MB 提交: 81 解决: 49 题目描述 注:本题只需要提交标记为修改部分之间的代码,请按照C++方式提交. 有AB ...
- YTU 2960: 改错题--小鼠标,你要干什吗?
2960: 改错题--小鼠标,你要干什吗? 时间限制: 1 Sec 内存限制: 128 MB 提交: 118 解决: 62 题目描述 鼠标双击不同的图标产生不同的效果,比如双击文档(documen ...
- YTU 2639: 改错题:类中私有成员的访问
2639: 改错题:类中私有成员的访问 时间限制: 1 Sec 内存限制: 128 MB 提交: 431 解决: 297 题目描述 /* 改错题: 设计一个日期类和时间类,并编写全局函数displ ...
- YTU 2622: B 虚拟继承(虚基类)-沙发床(改错题)
2622: B 虚拟继承(虚基类)-沙发床(改错题) 时间限制: 1 Sec 内存限制: 128 MB 提交: 487 解决: 393 题目描述 有一种特殊的床,既能当床(Bed)用又能当沙发(S ...
随机推荐
- zoj 2722 Head-to-Head Match(两两比赛)
Head-to-Head Match Time Limit: 2 Seconds Memory Limit: 65536 KB Our school is planning to hold ...
- Mysql的常见几种错误:1045,1044
Mysql的常见几种错误: 一.在进入 mysql 数据库时出错 # mysql -u root -p Enter password: ERROR 1045 (28000): Access den ...
- BZOJ1583: [Usaco2009 Mar]Moon Mooing 哞哞叫
给n<=4000000,c,a1,b1,c1,a2,b2,c2,以c为初始得到的数,每次可以把得到的某个数x进行操作f1(x)=a1*x/c1+b1,f2(x)=a2*x/c2+b2,求最后能得 ...
- msp430项目编程27
msp430中项目---多机通信系统 1.I2C工作原理 2.I2C通信协议 3.代码(显示部分) 4.代码(功能实现) 5.项目总结 msp430项目编程 msp430入门学习
- ACM常用模板整理
线段树单点修改区间查询 #include<stdio.h> #include<string.h> #include<algorithm> using namespa ...
- PAT (Advanced Level) 1037. Magic Coupon (25)
简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...
- CodeForces 429B【dp】
题意: 在一个n*m的矩阵中有两只虫子,一只从左上角向右下角移动,另外一只从左下角向右上角移动. 要求: 1.第一只虫子每次只能向左或者向下移动一格,另外一只只能向上或者向右移动一格. 2.两只虫子的 ...
- 《springMVC》学习笔记
1.SpringMVC框架 1.1 MVC在b/s系统下的应用 用户发送request请求到Controller Controller请求模型(Model)进行处理 Model将处理结果返回到Cont ...
- Spring实战Day2
创建对象之后如何体现对象之间的依赖? Spring容器负责创建Bean和依赖注入,那么Spring是怎么将Bean装配在一起的呢? Spring提供了三种方式装配机制 1.隐式的bean发现机制和自动 ...
- openstack ocata 的cell 和 placement api
The Ocata openstack just released recently. The official docs is not very stable yet. Some key steps ...