首页 > 代码库 > JLOI 提示问题

JLOI 提示问题

按照题目意思模拟即可。

 1 Program XJOI2265; 2 const a:array[1..10] of char=(a,e,i,o,u,A,E,I,O,U); 3 var s:ansistring; 4     len,i,j,sum,x,y:longint; 5     flag:boolean; 6 function check(ch:char):boolean; 7 begin 8     if (ch>=A) and (ch<=Z) or (ch>=a) and (ch<=z) then exit(true); exit(false); 9 end;10 function vowel(ch:char):boolean;11 var i:longint;12 begin13     for i:=1 to 10 do if ch=a[i] then exit(true); exit(false);14 end;15 begin16     readln(s);17     len:=length(s); sum:=0;18     for i:=1 to len do19         if check(s[i]) then20         begin21             write(.);22             inc(sum);23         end24         else write(s[i]);25     writeln;26 //---------------------- the first --------------------------27     x:=round(sum / 3);28     for i:=1 to len do29         if check(s[i]) then30             if x>0 then31             begin32                 write(s[i]);33                 dec(x);34                 if x=0 then y:=i;35             end36             else write(.)37         else write(s[i]);38     writeln;39 //----------------------- the second -------------------------40     flag:=false;41     for i:=y+1 to len do42         if vowel(s[i]) then43         begin44             flag:=true;45             break;46         end;47     for i:=1 to y do write(s[i]);48     if flag then49     for i:=y+1 to len do50         if check(s[i]) then51             if vowel(s[i]) then write(s[i]) else write(.)52         else write(s[i])53     else54     begin55         x:=round( sum*2/3)-round(sum/3);56         for i:=y+1 to len do57         if check(s[i]) then58             if x>0 then59             begin60                 write(s[i]);61                 dec(x);62                 end63             else write(.)64         else write(s[i]);65     end;66     writeln;67 //----------------------- the end -------------------------    68 69 end.

 

JLOI 提示问题