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 ...
随机推荐
- JavaScript中离线应用和客户端存储(cookies、sessionStorage、localStorage)
一.离线应用 所谓离线web应用,就是在设备不能上网的情况下仍然可以运行的应用. 开发离线web应用需要几个步骤:首先,确保应用知道设备是否能上网,以便下一步执行正确的操作:然后,应用还必须能访问一定 ...
- navicat不同数据库数据传输
复制fo的t_fo_account表结构和数据到base库 结果
- CDOJ 1220 The Battle of Guandu
The Battle of Guandu Time Limit: 6000/3000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Oth ...
- 外星联络(bzoj 2251)
Description 小 P 在看过电影<超时空接触>(Contact)之后被深深的打动,决心致力于寻找外星人的事业.于是,他每天晚上都爬在屋顶上试图用自己的收音机收听外星人发来的信息. ...
- java遍历文件夹及所有子文件
以前写代码循环文件夹和子文件时,总是自己写递归访问,今天研究lucene时,发现JDK给我们已经提供了访问遍历的方法,上代码: String str = "C:\\Users\\LLY\\D ...
- Java开发一些小的思想与功能小记(二)
1.用if+return代替复杂的if...else(if+return) public static void test1(String str) { if ("1".equal ...
- idea-自定义Java模板文件
自定义 idea Java 模板步骤. #parse("File Header.java")表示引用的模板文件,如下:
- c:forEach varStatus 属性
c:forEach varStatus 属性 current: 当前这次迭代的(集合中的)项 index: 当前这次迭代从 0 开始的迭代索引 count: 当前这次迭代从 1 开始的迭代计数 fir ...
- uva 11691
贪心 ~~ 使用优先队列 #include <cstdio> #include <cstdlib> #include <cmath> #include <se ...
- loj516 DP一般看规律(set启发式合并)
题目: https://loj.ac/problem/516 分析: 每次将一个颜色更改为另一个颜色相当于将两个集合合并 然后对于答案的更新,一个点插入到一个集合中,那么可能更新答案的就是其前驱节点或 ...