Guangxi University freshmen Programming Contest A

Here Insert Picture Description

Two-dimensional array of characters did not expect it hey
first dimension to my understanding is the index? ?
Then pay attention to start from zero
at this point is the pit several
other too much to complain of it

#include<bits/stdc++.h>
using namespace std;
const int maxn=1010;
char s[maxn][maxn];
int main()
{
	int n,m,q;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%s",s[i]);
	scanf("%d",&m);
	while(m--)
	{
		scanf("%d",&q);
		int len=strlen(s[q-1]);
		printf("\"");
		for(int i=0;i<len-1;i++)
			printf("%c ",s[q-1][i]);
		printf("%c\"\n",s[q-1][len-1]);
	}
	return 0;
}
Published 54 original articles · won praise 4 · Views 882

Guess you like

Origin blog.csdn.net/weixin_45460987/article/details/103448651