看了答案才知道了这题的各种骚操作,然后敲了一顿骚键盘,然后wa。调了很久,才发现要规格化打印……mdzz……

注:加粗代码为傻逼规格化打印代码:

#include <stdio.h>
#include <memory.h>
#include <math.h>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <map> #define I scanf
#define OL puts
#define O printf
#define F(a,b,c) for(a=b;a<c;a++)
#define FF(a,b) for(a=0;a<b;a++)
#define FG(a,b) for(a=b-1;a>=0;a--)
#define LEN 1010
#define MAX (1<<30)-1
#define V vector<int> #define MAP map<string,set<int> > //将名字映射为ID using namespace std; MAP mTitle,mAuthor,mKey,mPublish,mYear; void query(MAP & mp,string obj) {
set<int> s=mp[obj];
if(!s.size()) {
puts("Not Found");
return;
}
set<int>::iterator it=s.begin();
while(it!=s.end()) {
O("%07d\n",*it);
it++;
}
} int main() {
// freopen("1022.txt","r",stdin);
int N,id,K,op;
I("%d",&N) ;
char buf[];
while(N--) {
//ID
I("%d",&id);
getchar();//处理空格
//书名
gets(buf);
mTitle[string(buf)].insert(id);
//作者
gets(buf);
mAuthor[string(buf)].insert(id);
//关键词
while(I("%s",buf)) {
mKey[string(buf)].insert(id);
if(getchar()=='\n') break;
}
//出版商
gets(buf);
mPublish[string(buf)].insert(id);
//年
gets(buf);
mYear[string(buf)].insert(id);
}
I("%d",&K) ;
while(K--) {
I("%d: ",&op);
gets(buf);
O("%d: %s\n",op,buf);
switch(op) {
case :
query(mTitle,string(buf));
break;
case :
query(mAuthor,string(buf));
break;
case :
query(mKey,string(buf));
break;
case :
query(mPublish,string(buf));
break;
case :
query(mYear,string(buf));
break;
}
}
return ;
}

今日不宜编程……

最新文章

  1. Linux 学习记录
  2. 我的SQL总结---未完待续
  3. 深度讲解VIEWPORT和PX是什么?移动端单位px,em,rem
  4. JVM内存模型和关键参数设置
  5. apache中.htaccess不起作用
  6. 团队开发——冲刺1.g
  7. paip.语义相关是否可在 哈米 的语义分析中应用
  8. Python: 如何继承str/string?
  9. 名词释义(ActiveMQ 和 Webservice)
  10. Java Day 11
  11. Selenium 中使用方法小结
  12. C#中的面向对象编程
  13. undefined与null
  14. 1293: [SCOI2009]生日礼物
  15. yii2 邮件发送
  16. easyui 在编辑状态下,动态修改其他列值。
  17. Https协议与HttpClient的实现
  18. [android] 调用系统照相机和摄像机
  19. 开源作业调度框架 - Quartz.NET - ASP.NET部署
  20. blob下载出现多余乱码内容

热门文章

  1. python-5-str常用操作
  2. jquery实现移动端页面加载后,向上滚动指定距离无效引起的探索
  3. skeleton在心意web上的实践
  4. [Delphi]无边框窗口最大化不挡任务栏方法
  5. Zabbix 设置自动添加主机两种方法(自动注册、自动发现)
  6. Log4基本配置
  7. 英语Lignaloes沉香木LIGNALOES单词
  8. Django ORM 一对多 和 多对多
  9. cpu开多少线程合适(转)
  10. Java结构讲解