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年省赛
 #include <stdio.h>
#include <string.h> char str[][]; int cmp(const void *a,const void *b)
{
return *(char *)a - *(char *)b;
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int i,j,k;
getchar();
for(i=;i<n;i++)
scanf("%s",str[i]);
//qsort(str,n,sizeof(str[0]),cmp);
//for(i=0;i<n;i++)
//puts(str[i]);
for(k=,i=;i<n;i++)
{
if(strcmp(str[i],"bowl")==)
{
if(k)
printf(" ");
printf("%s",str[i]);
k++;
}
else if(strcmp(str[i],"chopsticks")==)
{
if(k)
printf(" ");
printf("%s",str[i]);
k++;
}
else if(strcmp(str[i],"fork")==)
{
if(k)
printf(" ");
printf("%s",str[i]);
k++;
}
else if(strcmp(str[i],"knife")==)
{
if(k)
printf(" ");
printf("%s",str[i]);
k++;
}
}
printf("\n");
}
return ;
}

//比我想象的简单

nyoj_218_Dinner_201312021434的更多相关文章

随机推荐

  1. 50.Ext_数字输入框_Ext.form.NumberField

    转自:https://blog.csdn.net/inflaRunAs/article/details/84033618 <mce:script type="text/javascri ...

  2. PCB javascript解析钻孔(Excellon)格式实现方法

    解析钻孔(Excellon)格式前首先得了解此格式,这样才能更好的解析呀. 一个钻孔里面包含的基本信息如下: 1.单位:公式mm,英制inch 2.省零方式:前省零,后省零 3.坐标方式:绝对坐标,相 ...

  3. Vue.js经典开源项目汇总-前端参考资源

    Vue.js经典开源项目汇总 原文链接:http://www.cnblogs.com/huyong/p/6517949.html Vue是什么? Vue.js(读音 /vjuː/, 类似于 view) ...

  4. 城市平乱 ---- Dijkstra

    题解 : 以暴乱城市 为 源点 向所有点做最短路径 , 然后检查每个不对到暴乱城市的 最短距离 #include<stdio.h> #include<string.h> #in ...

  5. echarts交叉关系图一

    想要做一个公司-人员关系图,官网echarts图graph webkit dep 稍微改了一下, 也是有点恶心自己,调了一个数据最多的去改,如果正好有人需要就不用去改了 说明:此图没有坐标,可以设置图 ...

  6. 控制台——EventLog实现事件日志操作

    我们应该如何通过写代码的方式向其中添加“日志”呢? 在操作之前,先明确几个概念: 1:事件日志名(logName):“事件查看器”中的每一项,如“应用程序”.“Internet Explorer”.“ ...

  7. 使用whIle循环语句和变量打印九九乘法表

    -设置i变量declare @i int --设置j变量declare @j int --设置乘法表变量declare @chengfabiao varchar(1000)--给i,j,@chengf ...

  8. c++将bool变量以文字形式打印

    #include <iostream> // std::cout, std::boolalpha, std::noboolalpha int main () { bool b = true ...

  9. Centos7搭建nginx并提供外网访问

    搭建nginx之后,80端口,其他机器无法访问 查询端口是否开启 firewall-cmd --query-port=80/tcp 永久开放80端口 firewall-cmd --permanent ...

  10. hibernate+struts2

    一.环境 添加struts2和hibernate的jar包.创建web.xml(配置struts的过滤器).struts2.xml和hibernate.cfg.xml(设置一些数据库参数). 二.创建 ...