題目不難,但是有些細節還是要注意的.....很容易wrong answer,如果你碰到WA,試試123012400198和1234這兩個測試用例吧!
// source code of submission 766632, Zhongshan University Online Judge System #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int cmp(int a,int b) { return a > b; } int main() { int t,i,k,len,zero[106]; char s[106]; scanf("%d",&t); while(t--) { scanf("%s",s); k = 0,len = strlen(s); for(i = 0;i < len;i++) if(s[i] == '0') zero[k++] = i; if(k==0) { sort(s,s+len,cmp); printf("%s\n",s); } else { if(zero[0]>=2) sort(s,s+zero[0],cmp); for(i = 0;i < k-1;i++) if(zero[i+1]-zero[i] > 2) sort(s+zero[i]+1,s+zero[i+1],cmp); if(zero[k-1]<len-2) sort(s+zero[k-1]+1,s+len,cmp); printf("%s\n",s); } } return 0; }
{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image"
{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"typ
{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockq
{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragr
{"type":"doc","content":[{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null
{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"爲什麼TDD很重要"
直播簡介 在這快速變化的時代,無論是何種規模的企業都在關注看重效能,研發效能的變革是許多 IT 公司首先要考慮的,例如研效平臺建設、度量體系建設、數據驅動管理等。藉助新技術、新工具等全面提升軟件工程效能。要達到 10 倍效能,需要利用一切可
{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"前言"}]},{"t
{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"前言","attrs