1 条题解
-
0
C++ :
#include <cstdio> #include <cstring> int main(){ char s[256]; if(!fgets(s, sizeof(s), stdin)) return 0; int L = (int)strlen(s); while(L>0 && (s[L-1]=='\n'||s[L-1]=='\r')) s[--L]=0; // 去掉行首空白 int st=0; while(st<L && (s[st]==' '||s[st]=='\t')) st++; // 找到号码部分起点:跳过 "(...) 区号" int p = st; if(p<L && s[p]=='('){ while(p<L && s[p]!=')') p++; if(p<L) p++; // 跳过 ')' } // 号码首位 char first = (p<L) ? s[p] : '0'; char ins = (first>='1' && first<='5') ? '6' : '8'; fwrite(s+st, 1, p-st, stdout); putchar(ins); printf("%s\n", s+p); return 0; }
- 1
信息
- ID
- 2913
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者