| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 146902 | hjx233333 | 字符串反转 | C++ | Runtime Error | 1 MS | 768 KB | 665 | 2026-02-01 11:47:35 |
#include <bits/stdc++.h> using namespace std; int main() { string a; int i,j,k,m,n,t,f; scanf("%d",&t); getchar(); while(t--) { getline(cin,a); char b[501][1001],temp[1001]; i=0; j=0; n=a.size(); //printf("%d\n",n); while(i<n) { f=0; while(true) { b[j][f++]=a[i]; i++; if(a[i]==' ') { b[j][f]='\0'; j++; break; } } i++; } n=j; //printf("%d\n",n); i=0; while(i<n) { strcpy(temp,b[i]); reverse(temp,temp+strlen(temp)); strcpy(b[i],temp); i++; } i=0; while(i<n) printf("%s ",b[i++]); printf("\n"); } return 0; }
Runtime Error:Segmentation fault