nyoj_218_Dinner_201312021434
Dinner
- 描述
- 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的更多相关文章
随机推荐
- Oracle查询列重命名
select count(*) 呼入量 from crm_cisco_call_detail
- php验证邮箱是否合法
下面我来总结了在php邮箱验证的正则表达式以及还可以checkdnsrr函数来验证你输入的邮箱是否是有效的哦,这样可以更好的过滤到无效邮箱地址哦. 域名由各国文字的特定字符集.英文字母.数字及 ...
- Akka源码分析-Remote-收发消息UL图
- CTSC+APIO+THUACM游记
退役之前,写点破事乐呵乐呵.. (同DaD3zZ) CTSC Day0 来到丽都 哈哈哈这可是四星级豪华酒店啊 想想要在这住7天 美滋滋 换了半天的房间 也没有换到一起 最后yzy& ...
- 【LeetCode】105 & 106 Construct Binary Tree from (Preorder and Inorder) || (Inorder and Postorder)Traversal
Description: Given arrays recording 'Preorder and Inorder' Traversal (Problem 105) or 'Inorder and ...
- 安装cloudermanager时如何正确Configuring TLS Security for Cloudera Manager
不多说,直接上干货! 参考官网 https://www.cloudera.com/documentation/enterprise/5-2-x/topics/cm_sg_config_tls_secu ...
- ansible 显示运行时间
#独家秘诀cd /etc/ansible mkdir callback_plugins cd callback_plugins wget https://raw.githubusercontent.c ...
- XML解析-Dom4j的DOM解析方式更新XML
Dom4j工具,是非官方的,不在jdk中. 使用步骤: 1)导入dom4j的核心包. dom4j-1.6.1.jar 2)编写Dom4j读取xml文件的代码 1.更新XML 1.1.写出内容到xml文 ...
- python框架之Flask基础篇(一)
一.第一个hello world程序 # coding=utf-8 from flask import Flask app = Flask(__name__) @app.route('/') def ...
- 在ubuntu系统下下载和卸载skype
1.下载 sudo apt-get install skypeforlinux 2.卸载 sudo apt remove skypeforlinux