码迷,mamicode.com
首页 > 其他好文 > 详细

JLOI 提示问题

时间:2015-01-12 22:17:35      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

按照题目意思模拟即可。

 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 begin
13     for i:=1 to 10 do if ch=a[i] then exit(true); exit(false);
14 end;
15 begin
16     readln(s);
17     len:=length(s); sum:=0;
18     for i:=1 to len do
19         if check(s[i]) then
20         begin
21             write(.);
22             inc(sum);
23         end
24         else write(s[i]);
25     writeln;
26 //---------------------- the first --------------------------
27     x:=round(sum / 3);
28     for i:=1 to len do
29         if check(s[i]) then
30             if x>0 then
31             begin
32                 write(s[i]);
33                 dec(x);
34                 if x=0 then y:=i;
35             end
36             else write(.)
37         else write(s[i]);
38     writeln;
39 //----------------------- the second -------------------------
40     flag:=false;
41     for i:=y+1 to len do
42         if vowel(s[i]) then
43         begin
44             flag:=true;
45             break;
46         end;
47     for i:=1 to y do write(s[i]);
48     if flag then
49     for i:=y+1 to len do
50         if check(s[i]) then
51             if vowel(s[i]) then write(s[i]) else write(.)
52         else write(s[i])
53     else
54     begin
55         x:=round( sum*2/3)-round(sum/3);
56         for i:=y+1 to len do
57         if check(s[i]) then
58             if x>0 then
59             begin
60                 write(s[i]);
61                 dec(x);
62                 end
63             else write(.)
64         else write(s[i]);
65     end;
66     writeln;
67 //----------------------- the end -------------------------    
68 
69 end.

 

JLOI 提示问题

标签:

原文地址:http://www.cnblogs.com/rpSebastian/p/4219912.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!