- 学姐的清晨问候
- 2015-02-17 10:39:53 @
代码如下 只过了第二个点
program p1902(input,output);
const st1='Case #';
var greet:array[0..7] of longint;
i,j,k,n,l,s:longint;
st:ansistring;
flag:boolean;
begin
readln(n);
for i:=1 to n do
begin
readln(st);
l:=length(st);
for j:=1 to l do
begin
case st[j] of
' ':inc(greet[0]);
'g':inc(greet[1]);
'o':inc(greet[2]);
'd':inc(greet[3]);
'm':inc(greet[4]);
'r':inc(greet[5]);
'n':inc(greet[6]);
'i':inc(greet[7]);
{'G':inc(greet[1]);
'O':inc(greet[2]);
'D':inc(greet[3]);
'M':inc(greet[4]);
'R':inc(greet[5]);
'N':inc(greet[6]);
'I':inc(greet[7]);}
end;
end;
//for j:=0 to 7 do writeln(greet[j]);
s:=0;
flag:=true;
while flag do
begin
if greet[0]>=1 then dec(greet[0],1) else flag:=false;
if greet[1]>=2 then dec(greet[1],2) else flag:=false;
if greet[2]>=3 then dec(greet[2],3) else flag:=false;
if greet[3]>=1 then dec(greet[3],1) else flag:=false;
if greet[4]>=1 then dec(greet[4],1) else flag:=false;
if greet[5]>=1 then dec(greet[5],1) else flag:=false;
if greet[6]>=2 then dec(greet[6],2) else flag:=false;
if greet[7]>=1 then dec(greet[7],1) else flag:=false;
if flag then inc(s);
end;
writeln(st1,i,': ',s);
end;
end.
0 条评论
信息
- ID
- 1902
- 难度
- 7
- 分类
- (无)
- 标签
- (无)
- 递交数
- 1572
- 已通过
- 340
- 通过率
- 22%
- 被复制
- 6
- 上传者