2017年10月18日普及组 文件名排序
生活随笔
收集整理的這篇文章主要介紹了
2017年10月18日普及组 文件名排序
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
程序:
var l,n,i,j,p:longint; a,b,c,s:array[1..1000]of string; w:string; beginreadln(n);for i:=1 to n doreadln(a[i]);for i:=1 to n dobeginp:=pos('.',a[i]);s[i]:=a[i];l:=length(s[i]);if p>0 thenbeginb[i]:=copy(s[i],p+1,l-p);c[i]:=copy(s[i],1,p-1);end elsebeginb[i]:='zzz';c[i]:=s[i];end;end;for i:=1 to n-1 dofor j:=i+1 to n doif b[i]>b[j] thenbeginw:=b[i];b[i]:=b[j];b[j]:=w;w:=c[i];c[i]:=c[j];c[j]:=w;w:=s[i];s[i]:=s[j];s[j]:=w;end;for i:=1 to n-1 dofor j:=i+1 to n doif c[i]>c[j] thenif b[i]>=b[j] thenbeginw:=b[i];b[i]:=b[j];b[j]:=w;w:=c[i];c[i]:=c[j];c[j]:=w;w:=s[i];s[i]:=s[j];s[j]:=w;end;for i:=1 to n dofor j:=1 to n doif a[i]=s[j] thenbeginwriteln(j);break;end; end.轉(zhuǎn)載于:https://www.cnblogs.com/YYC-0304/p/9500033.html
總結(jié)
以上是生活随笔為你收集整理的2017年10月18日普及组 文件名排序的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2017年10月18日普及组 面积最大
- 下一篇: 2017年10月21日普及组 排名