#include <stdio.h> #include <stdlib.h> int main() { int n; char str[100000];// 分配足够的空间来存储字符串 scanf("%d", &n);// 读取整数 n scanf("%s", str);// 读取字符串 // 逆序打印字符串的前 n 个字符 for (int i = n - 1; i >= 0; i--) { printf("%c", str[i]); } return 0; }
#include <stdio.h> #include <stdlib.h> int main() { int n; char str[100000];// 分配足够的空间来存储字符串 scanf("%d", &n);// 读取整数 n scanf("%s", str);// 读取字符串 // 逆序打印字符串的前 n 个字符 for (int i = n - 1; i >= 0; i--) { printf("%c", str[i]); } return 0; }