| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 159458 | Kevin | 单词翻转 | C++ | Accepted | 1 MS | 272 KB | 474 | 2026-08-31 17:21:33 |
#include<bits/stdc++.h> using namespace std; char a[1005]; int main(){ int tou=0,wei=0,chang=0; cin.getline(a,1005); int len=strlen(a); for(int i=0;i<len;i++){ wei++; if(a[i]!=' '){ if(chang==0){ tou=i; } chang++; } else{ if(chang>0){ for(int j=wei-2;j>=tou;j--){ cout<<a[j]; } } cout<<a[i]; chang=0; } } if(chang>0){ for(int j=wei-1;j>=tou;j--){ cout<<a[j]; } } return 0; }