国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

P1603 斯諾登的密碼

2019-11-14 09:16:50
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

題目描述

輸入一串只有六個(gè)單詞和一個(gè)句號(hào)的句子,單詞與單詞之間空格隔開(kāi),把其中所有數(shù)字找出來(lái)(正常:one...ten,特殊:a both another first second third)把每個(gè)數(shù)字的平方排序(不足兩位數(shù)的前面補(bǔ)零),組成最小的數(shù)字(開(kāi)頭去零)輸出。

樣例輸入

Black Obama is two five zero .

樣例輸出

425

思路

O(N^2)按題意把所有數(shù)字平方后排序輸出。var a,b,ans:string; i,j,k,l:longint; z:array[1..20] of longint; c:array[1..10] of string;begin readln(a); for i:=1 to 6 do begin j:=pos(' ',a); if pos('.',a)<j then j:=pos('.',a); b:=copy(a,1,j-1); if (b='one')or(b='a')or(b='another')or(b='first') then inc(z[1]); if (b='two')or(b='both')or(b='second') then inc(z[2]); if (b='third')or(b='three') then inc(z[3]); if b='four' then inc(z[4]); if b='five' then inc(z[5]); if b='six' then inc(z[6]); if b='seven' then inc(z[7]); if b='eight' then inc(z[8]); if b='nine' then inc(z[9]); if b='ten' then inc(z[10]); if b='eleven' then inc(z[11]); if b='twelve' then inc(z[12]); if b='thirteen' then inc(z[13]); if b='fourteen' then inc(z[14]); if b='fifteen' then inc(z[15]); if b='sixteen' then inc(z[16]); if b='seventeen' then inc(z[17]); if b='eighteen' then inc(z[18]); if b='nineteen' then inc(z[19]); if b='twenty' then inc(z[20]); delete(a,1,j); end; for i:=1 to 20 do while z[i]<>0 do begin inc(j); str(i*i,c[j]); k:=length(c[j]); if k>2 then delete(c[j],1,1); if k=1 then insert('0',c[j],1); dec(z[i]); end; for i:=1 to j-1 do for k:=i+1 to j do if c[i]>c[k] then begin b:=c[i];c[i]:=c[k];c[k]:=b; end; if c[i,1]='0' then delete(c[i],1,1); for i:=1 to j do write(c[i]);end.
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 固镇县| 海兴县| 柳州市| 苗栗市| 蕲春县| 象山县| 南郑县| 屏东市| 上饶市| 清新县| 镇雄县| 石阡县| 海口市| 昂仁县| 湟中县| 九寨沟县| 将乐县| 五莲县| 乾安县| 拉孜县| 文登市| 上林县| 浪卡子县| 松原市| 裕民县| 九龙城区| 永昌县| 垣曲县| 普兰店市| 沅陵县| 龙岩市| 郯城县| 铁岭市| 兴安盟| 海兴县| 南陵县| 沅江市| 吴忠市| 邯郸市| 广宗县| 屯留县|