poj 2013 Symmetric Order

简介:

今天早上水过的第3题,简单的字符串处理,其实我只用了输出处理,连排序都没用。。。


#include <stdio.h>

int main()
{
	int n;
	int i;
	char string[20][30];
	int count=0;

	while(scanf("%d",&n))
	{
		if(n==0)
			break;

		for(i=1;i<=n;i++)
		{
			scanf("%s",string[i]);
			//printf("%s\n",string[i]);
		}

		printf("SET %d\n",++count);

		for(i=1;i<=n;i+=2)
			printf("%s\n",string[i]);

		if(n%2!=0)
			n--;

		for(i=n;i>=2;i-=2)
			printf("%s\n",string[i]);
	}

	return 0;
}


相关文章
|
6月前
Leetcode 377. Combination Sum IV
赤裸裸的完全背包,属于动态规划的范畴,大家有兴趣可以在网上搜索下其他资料。个人觉得动态规划还是比较难理解的,更难给别人讲清楚,所以这里我直接附上我的代码供大家参考。
25 0
LeetCode 377. Combination Sum IV
给定一个由正整数组成且不存在重复数字的数组,找出和为给定目标正整数的组合的个数。
72 0
LeetCode 377. Combination Sum IV
LeetCode 216. Combination Sum III
找出所有相加之和为 n 的 k 个数的组合。组合中只允许含有 1 - 9 的正整数,并且每种组合中不存在重复的数字。
79 0
LeetCode 216. Combination Sum III
LeetCode 39. Combination Sum
给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。
55 0
LeetCode 39. Combination Sum
|
Python
LeetCode 103. BTree Zigzag Level Order Traversal
给定二叉树,返回其节点值的Z字形级别遍历。 (即,从左到右,然后从右到左进行下一级别并在之间交替)。
51 0
LeetCode 103. BTree Zigzag Level Order Traversal
|
人工智能 Java
|
机器学习/深度学习 存储 人工智能
|
算法
[LeetCode]--101. Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \ 3
941 0