UPC_Shandong muti-university Contest Problem I——The war of 3Q
来源:互联网 发布:淘宝网 返利哪个好 编辑:程序博客网 时间:2024/05/21 08:36
比赛链接:点击打开链接
Problem I: The war of 3Q.
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 50 Solved: 10
[Submit][Status][Web Board]
Description
One day,China's Internet firm Tencent said it is shutting down its popular instant messaging service QQ on computers installed with anti-virus software run by the company's rivalQihoo360, as a war between the two software giants escalated over the course of the past several months.
Input
INPUT:
This problem has two parts.
Part #1:
The first line of Part #1 is an integer N(N<=100), which stands for the number of operations:
Then N lines follow, each line as an operation.
The operations should be described as :
Create File_name Ext_name
If there is a file called File_name,then output “File already exist!” and ignore this operation, else create that file.
Delete File_name
If there is a file called File_name,then remove it;else output ”No such file!” and ignore this operation.
QQ File_name
If the file called File_name does not exist, output”No such file!”; else if the Ext_name is”exe” then output ”QQ has not collected your private information!”, otherwise output ” QQ has collected your private information!”.
Part #2:
There is a list of softwares by Qihoo 360.
360SAFE
360BROWSER
QQGUARD
360SD
360DESKTOP
360YASUO
360WD
360SAFEBOX
The following line is an integer M(M<=100), which stands for the number of operations:
Then M lines follow, each line as an operation.
The operations should be described as:
Install Software_name
If the software called Software_name is installed, output “The software is already installed!” and ignore the operation; else install it.
Uninstall Software_name
If the software called Software_name does not exist, output “The software is not found!” and ignore the operation; else uninstall it.
360
If all the softwares in the list are installed in your computer, output “Your computer is secure!” else output “Your computer is not secure!”
Output
The output is specified before.
Sample Input
5Create qq exeCreate search datQQ searchDelete qqmusicCreate qq exe3Install 360SAFEInstall 360SAFE360
Sample Output
QQ has collected your private information!No such file!File already exist!The software is already installed!Your computer is not secure!
模拟题,没什么好说的,注意手一定不要残,还有就是不要怕麻烦,思路顺了很EASY。
#include <iostream> #include <cmath> #include <cstring> #include <map> #include <string> using namespace std; class file { public: string mainfile; string ext; }; file ls[100]; int main() { int testcase1,testcase2; cin>>testcase1; { string op,tarfile,ext; map<string,int> filelist; map<string,int> softwarelist; map<string,int>::iterator itp; int ucount=0; while(testcase1--) { map<string,int>::iterator it; cin>>op>>tarfile; if(op[0]=='C') { cin>>ext; ls[ucount].mainfile=tarfile; ls[ucount].ext=ext; ucount++; } if(op[0]=='C') { it=filelist.find(tarfile); if(it!=filelist.end()) { cout<<"File already exist!"<<endl; continue; } else filelist[tarfile]++; } else if(op[0]=='D') { it=filelist.find(tarfile); if(it==filelist.end()) { cout<<"No such file!"<<endl; continue; } else { filelist.erase(it); } } else if(op[0]=='Q') { it=filelist.find(tarfile); if(it==filelist.end()) { cout<<"No such file!"<<endl; } else { for(int i=0;i<=ucount;i++) { if(ls[i].mainfile==tarfile) { if(ls[i].ext=="exe") { cout<<"QQ has not collected your private information!"<<endl; break; } else { cout<<"QQ has collected your private information!"<<endl; break; } } } } } } string soft; cin>>testcase2; while(testcase2--) { map<string,int>::iterator it; cin>>op; if(op!="360") cin>>soft; if(op[0]=='I') { it=softwarelist.find(soft); if(it!=softwarelist.end()) { cout<<"The software is already installed!"<<endl; } else softwarelist[soft]++; } else if(op[0]=='U') { it=softwarelist.find(soft); if(it==softwarelist.end()) { cout<<"The software is not found!"<<endl; continue; } else softwarelist.erase(it); } else if(op[0]=='3') { int soft=0; for(itp=softwarelist.begin();itp!=softwarelist.end();itp++) { if((*itp).first=="360SAFE"||(*itp).first=="360BROWSER"||(*itp).first=="QQGUARD"||(*itp).first=="360SD"||(*itp).first=="360DESKTOP"||(*itp).first=="360YASUO"||(*itp).first=="360WD"||(*itp).first=="360SAFEBOX") { soft++; continue; } } if(soft==8) { cout<<"Your computer is secure!"<<endl; } else { cout<<"Your computer is not secure!"<<endl; } } } } return 0; } /************************************************************** Problem: 2136 User: warm_nova Language: C++ Result: Accepted Time:20 ms Memory:1276 kb ****************************************************************/
- UPC_Shandong muti-university Contest Problem I——The war of 3Q
- 2013 Multi-University Training Contest 3 (g) The Unsolvable Problem
- HDU 5318 The Goddess Of The Moon(构造矩阵 )——2015 Multi-University Training Contest 3
- HDU 5373 The shortest problem(模拟)——2015 Multi-University Training Contest 7
- 2014 Multi-University Training Contest 1 —I Turn the pokers
- 2013 Multi-University Training Contest 1——I-number
- hdu-5318 The Goddess Of The Moon(2015 Multi-University Training Contest 3)
- HDU HDU 3861 The King’s Problem 2011 Multi-University Training Contest 3 - Host by BIT
- The University of Chicago Invitational Programming Contest 2012 解题报告
- 2015 Multi-University Training Contest 8 The sum of gcd
- hdu 5858 Hard problem(2016 Multi-University Training Contest 10——数学题)
- hdu 5867 Water problem(2016 Multi-University Training Contest 10——水题)
- 2016 Al-Baath University Training Camp Contest-1 I. March Rain —— 二分
- 2017 Wuhan University Programming Contest 现场赛I: A simple math problem(矩阵快速幂)
- 2017 Wuhan University Programming Contest 现场赛 I.A simple math problem(矩阵快速幂)
- Q.3.4 To solve the problem of hanoi
- Multi-University Training Contest 3 — 1004题
- HDU 6128 Inverse of sum(数论)——2017 Multi-University Training Contest
- cat 命令
- offsetParent的理解
- remap_pfn_range()函数及应用
- Cocos2d-X Meta-Project Setup
- java 调用命令行 备份mysql数据库
- UPC_Shandong muti-university Contest Problem I——The war of 3Q
- Android 开发笔记 动画效果 --Animation
- rac把数据文件创建在不共享的地方
- mmap方法实现物理内存到用户虚拟地址的映射
- windows 批处理
- 8.1 - 8.5 标准IO库
- 教你如何把控版式第五季 (案例)
- C语言学习第三天(位操作)
- vss2005 配置详解