题目截图:
思路:
先输入整行字符串,然后按空格分割字符串,最后逆序输出。
代码:
1 /* 2 1009. 说反话 3 */ 4 5 #include <stdio.h> 6 #include <string.h> 7 #include <math.h> 8 #include <stdlib.h> 9 #include <time.h> 10 11 #define maxn 82 12 char str[maxn]; // 存储整行字符 13 char s[maxn][maxn]; // 存储整行字符 14 15 int main() { 16 int i, j=0, k=0, flag=0; 17 gets(str); 18 for(i=0; i<strlen(str); ++i) { 19 if(str[i] == ' ') { // 按空格分割字符 20 s[j][k] = '