题解 | 单词倒排活动地址: 牛客春招刷题训练营 - 编程打卡活动
单词倒排
https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
#include <stdio.h>
#include <stdlib.h>
int main(){
char str[1010][22]; // 二维字符数组
int n=0,x;
while(1){
x=scanf("%[a-z|A-Z]",&str[n]);//用scanf函数的读入指定字符集的功能
if(getchar()=='\n')break;//读到换行就结束
if(x)n++;
}
// 倒着输出
for(int i=n;i>=0;i--)printf("%s ",str[i]);
return 0;
}
活动地址: 牛客春招刷题训练营 - 编程打卡活动
文远知行公司福利 561人发布

查看11道真题和解析