nyoj 218 Dinner(水题)

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年省赛
上传者

ACM_李如兵

南阳OJ上的说是贪心,我也是醉了,太水了,不考虑最后元素的空格竟然也能过,我。。。。。。

代码如下:

#include<stdio.h>
#include<string.h>
char a[110][110];
int main()
{
	int n,i;
	while(~scanf("%d",&n))
	{
		for(i=0;i<n;i++)
		{
			scanf("%s",a[i]);
		}
		for(i=0;i<n;i++)
		{
			if(strcmp(a[i],"bowl")==0)
			printf("bowl ");
			if(strcmp(a[i],"knife")==0)
			printf("knife ");
			if(strcmp(a[i],"fork")==0)
			printf("fork ");
			if(strcmp(a[i],"chopsticks")==0)
			printf("chopsticks ");
		}
		printf("\n");
	}
	return 0;
}
时间: 2024-11-05 12:52:45

nyoj 218 Dinner(水题)的相关文章

NYOJ 218 Dinner

#include<stdio.h>#include<string.h>int main(){ int n,i,k; char str[10],s[1010][10]; while(scanf("%d",&n)!=EOF) { k=0; memset(s,0,sizeof(s)); for(i=0;i<n;i++) { scanf("%s",str); if(strcmp(str,"bowl")==0 ||st

nyoj 755 山谷 (水题)

题目755 题目信息 运行结果 本题排行 讨论区 山谷 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 八百里伏牛山连绵不断,高低起伏. 家住山脚下的小明开始学习识数了,面朝群山,他想数一下对面有多少山谷,请你写个程序帮他检验一下他数的结果是否正确. 输入 有多组测试数据. 对于每组数据: 第一行: N(2<N<10000) 第二行有N个正整数,分别代表山脉从左到右的高度Hi(0<Hi<1000). 输出 输出每组数据中山谷的个数. 样例输入 3 2

nyoj 1099 Lan Xiang&#39;s Square (水题)

题目1099 题目信息 运行结果 本题排行 讨论区 Lan Xiang's Square 时间限制:1000 ms  |  内存限制:65535 KB 难度:0 描述 Excavator technology which is strong, fast to Shandong to find Lan Xiang. Then the question comes.. :) for this problem , i will give you four points. you just judge

nyoj 1208——水题系列——————【dp】

水题系列 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述     给你一个有向图,每条边都有一定的权值,现在让你从图中的任意一点出发,每次走的边的权值必须必上一次的权值大的情况下,问你最多能走几条边? 输入 首先一个n和m,分别表示点的数目和边的数目接下来m行,每行三个值x,y,val,表示x到y有路,其权值为val.(1<n,m,val<10^5,0<x,y<=n) 输出 输出最多有的边的数目 样例输入 3 3 1 2 1 2 3 1 3 1 1 6

2015南阳CCPC L - Huatuo&#39;s Medicine 水题

L - Huatuo's Medicine Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Huatuo was a famous doctor. He use identical bottles to carry the medicine. There are different types of medicine. Huatuo put medicines into the bottles and chain these b

sdut 2841 Bit Problem (水题)

题目 贴这个题是因为看题解有更简单的方法, 我做的时候是直接算的, 也很简单. 贴一下题解吧: 如果一个整数不等于 0,那么该整数的二进制表示中至少有一位是 1. 这个题结果可以直接输出 x - (x&(x-1)); 因为x-1 之后二进制下,就是最右边的1变成了0, 最右边的1的 右边所有的0变成了1, 不影响最左边. 我的代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4

sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理)

n a^o7 ! Time Limit: 1000MS Memory limit: 65536K 题目描述 All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and happiness. If you want to win the battle, you must do warm-up according to my inst

杭电(hdu)2053 Switch Game 水题

Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13113    Accepted Submission(s): 7970 Problem Description There are many lamps in a line. All of them are off at first. A series of o

4.7-4.9补题+水题+高维前缀和

题目链接:51nod 1718 Cos的多项式  [数学] 题解: 2cosx=2cosx 2cos2x=(2cosx)^2-2 2cos3x=(2cosx)^3-3*(2cosx) 数归证明2cos(nx)能表示成关于2cosx的多项式,设为f(n) f(1)=x,f(2)=x^2-2(其中的x就是2cosx) 假设n=1~k时均成立(k>=3) 当n=k+1时 由cos((k+1)x)=cos(kx)cos(x)-sin(kx)sin(x) cos((k-1)x)=cos(kx)cos(x)