Dinner

时间限制:100 ms  |           内存限制:65535 KB
难度:1
描述
Little A is one member of ACM team. He had just won the gold in World Final. To celebrate, he decided to invite all to have one meal. As bowl, knife and other tableware is not enough in the kitchen, Little A goes to take backup tableware in warehouse. There are many boxes in warehouse, one box contains only one thing, and each box is marked by the name of things inside it. For example, if "basketball" is written on the box, which means the box contains only basketball. With these marks, Little A wants to find out the tableware easily. So, the problem for you is to help him, find out all the tableware from all boxes in the warehouse.
输入
There are many test cases. Each case contains one line, and one integer N at the first, N indicates that there are N boxes in the warehouse. Then N strings follow, each string is one name written on the box.
输出
For each test of the input, output all the name of tableware.
样例输入
3 basketball fork chopsticks
2 bowl letter
样例输出
fork chopsticks
bowl
提示
The tableware only contains: bowl, knife, fork and chopsticks.
来源
辽宁省10年省赛
 1 #include <stdio.h>
 2 #include <string.h>
 3
 4 char str[1000][100];
 5
 6 int cmp(const void *a,const void *b)
 7 {
 8     return *(char *)a - *(char *)b;
 9 }
10 int main()
11 {
12     int n;
13     while(scanf("%d",&n)!=EOF)
14     {
15         int i,j,k;
16         getchar();
17         for(i=0;i<n;i++)
18         scanf("%s",str[i]);
19         //qsort(str,n,sizeof(str[0]),cmp);
20         //for(i=0;i<n;i++)
21         //puts(str[i]);
22         for(k=0,i=0;i<n;i++)
23         {
24             if(strcmp(str[i],"bowl")==0)
25             {
26                 if(k)
27                 printf(" ");
28                 printf("%s",str[i]);
29                 k++;
30             }
31             else if(strcmp(str[i],"chopsticks")==0)
32             {
33                 if(k)
34                 printf(" ");
35                 printf("%s",str[i]);
36                 k++;
37             }
38             else if(strcmp(str[i],"fork")==0)
39             {
40                 if(k)
41                 printf(" ");
42                 printf("%s",str[i]);
43                 k++;
44             }
45             else if(strcmp(str[i],"knife")==0)
46             {
47                 if(k)
48                 printf(" ");
49                 printf("%s",str[i]);
50                 k++;
51             }
52         }
53         printf("\n");
54     }
55     return 0;
56 }

//比我想象的简单

转载于:https://www.cnblogs.com/xl1027515989/p/3453976.html

nyoj_218_Dinner_201312021434相关推荐

最新文章

  1. java.net import_import java.net.URL;是什么类?
  2. 【STM32】按键检测实验主要程序代码分析
  3. linux下安装虚拟天文馆,如何在Ubuntu 20.04、18.04中安装Stellarium 0.20.0虚拟天文馆
  4. 智能电视可以安装鸿蒙操作系统吗,华为鸿蒙系统竟然支持安装第三方软件了?这再也不鸿蒙了...
  5. windows和linux加密u盘,linux挂载windows的各种格式U盘
  6. VirtualBox4.3.12 安装ubuntu 14.04 分辨率过小(600*480)问题的解决方法
  7. php 标签库,PHP.MVC的模板标签系统之模板标签库
  8. shell通过sshpass远程ssh执行命令
  9. zabbix监控SNMP
  10. git的丰富实用经验
  11. 华为user-bind不允许使用dhcp功能的情况下的使用
  12. 高性能mysql学习笔记一
  13. SPSS统计分析行业应用实战--SPSS 22.0新增
  14. 最优化理论与凸优化的用处
  15. TCP/IP(三):ARP报文格式详解
  16. 解决bootstrap中模态框打开时页面发生一瞬间移动
  17. python web游戏实例_Python实现小黑屋游戏的完整实例
  18. 整理:不用ACE你不知道ACE有多烂,给饱受ACE折磨的弟兄们散分了。
  19. Android流式布局FlowLayout,一款针对Tag的布局
  20. SLO 和 SLI的最佳实践

热门文章

  1. ThinkPHP6项目基操(20.实战部分 数据库操作返回值总结)
  2. Qt工作笔记-如何打包我们用 Qt 写的软件 - Linux 篇
  3. 前端笔记-echarts加载bmap地图
  4. HTML期末网页作业-仿QQ官网QQ注册网页
  5. 怎么修改图例位置_学到了学到了,叠加图,原来可以这样处理图例
  6. java equ,Java equals方法详解
  7. 24口光纤配线架 cad块_光纤配线架cad画法
  8. omnigraffle 画曲线_Omnigraffle画线框图的新手操作指南
  9. python二级最后一题_python二级考试操作题2.pdf
  10. python time timeit_python运行时间计算之timeit