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的更多相关文章
随机推荐
- C# Pen绘制虚线(System.Drawing.Pen与System.Windows.Media.Pen)
一.绘制虚线的方法 GDI绘制,使用的是System.Drawing.Pen Pen pen = new Pen(Color.Red, 1); pen.DashStyle = S ...
- Ansi2Utf8 小工具
将GB2312编码的文件转成Unity使用的UTF8无bom格式 主要用批处理执行 Ansi2Utf8.exe XXXXX.txt 源代码 using System; using System.Co ...
- keystone身份认证服务
Keystone介绍 keystone 是OpenStack的组件之一,用于为OpenStack家族中的其它组件成员提供统一的认证服务,包括身份验证.令牌的发放和校验.服务列表.用户权限的定义等等.云 ...
- SQLYog 快捷键
SQLYog常用快捷键 Ctrl+M 创建一个新的连接Ctrl+N 使用当前设置新建连接Ctrl+F4 断开当前连接 对象浏览器F5 刷新对象浏览器(默认)Ctr ...
- Django总结一
HTTPRequest与HTTPresponse 一. 1.互联网两台机器之间通行:ip.端口.协议 - 协议 - HTTP (80) - HTTPS (443) 2.浏览器输入URL一回车返回页面发 ...
- ACM_小G的循环
小G的循环 Time Limit: 2000/1000ms (Java/Others) Problem Description: 一回生,二回熟,三回就腻,小G用for,while循环用得太多了,累觉 ...
- JQuery中常用的$.get(),$.post(),$.ajax(),$.getJSON(),load()的详解与区别
背景:因为最近需要获取本地的数据件进行项目测试,需要用到JQuery实现数据文件的读取,但是由于对JQuery内的获取文件方式不太了解,这次趁着机会进行一下总结.因为该总结是本人根据平常的使用及网上的 ...
- Android 6.0 如何添加完整的系统服务(app-framework-kernel)
最近学习了如何在Android 6.0上添加一个系统服务,APP如何通过新增的系统服务访问底层驱动.在这学习过程中,收获颇多,并结合学习了<Embeded Android>--Karim ...
- ajax 实现输入提示效果
网站主页 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...
- webpack核心概念使用的综合小案例
注: 由于版本更新很快,同样的配置不同版本很可能会出错(这个就很绝望了) 解决思路 看文档 查看源码接口 网上搜索相应错误 环境 webpack4.x + yarn 文件结构 . ├── dist / ...