382 条题解
-
0
chenzhuo LV 7 @ 2009-08-15 17:28:09
这还容易,难度还只有1,程序却这么长5555555
-
02009-08-05 16:12:20@
审题!
55555~~~~(>_ -
02009-07-26 17:18:03@
交了3次终于AC,一个ansistring竟还装不了全部输入数据
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msvar s:array[1..1000000] of char;
tmp:string;
b:boolean;
c,w,l,temp,d,last,lengths:longint;begin
b:=true;
lengths:=0;
while b do
begin
readln(tmp);
if pos('E',tmp)0 then
begin
delete(tmp,pos('E',tmp),255);
b:=false;
end;
while pos(' ',tmp)0 do
delete(tmp,pos(' ',tmp),1);
for c:=1 to length(tmp) do
begin
lengths:=lengths+1;
s[lengths]:=tmp[c];
end;
end;
b:=true;
last:=1;
while b do
begin
w:=0;
l:=0;
for d:=last to lengths do
begin
if s[d]='W' then w:=w+1;
if s[d]='L' then l:=l+1;
if ((w>=11)or(l>=11))and(abs(w-l)>=2) then break;
end;
last:=d+1;
writeln(w,':',l);
if last>lengths then b:=false;
if ((w>=11)or(l>=11))and(abs(w-l)>=2)and(b=false) then
writeln('0:0');
end;
writeln;
b:=true;
last:=1;
while b do
begin
w:=0;
l:=0;
for d:=last to length(s) do
begin
if s[d]='W' then w:=w+1;
if s[d]='L' then l:=l+1;
if ((w>=21)or(l>=21))and(abs(w-l)>=2) then break;
end;
last:=d+1;
writeln(w,':',l);
if last>length(s) then b:=false;
if ((w>=21)or(l>=21))and(abs(w-l)>=2)and(b=false) then
writeln('0:0');
end;
end. -
02009-07-26 16:11:09@
貌似在10:11这样的情况下要继续打??。。。
记得是分差超过2分才能判赢的。。。 -
02009-07-25 20:34:19@
欺负我不懂乒乓球知识.......
用超长字符串会更好吧 -
02009-07-23 11:34:47@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
题目很水,数据很阴。。。
首先要注意输出的比赛结果的字符串数组至少开10000
其次0:0是要输出的。。。
就这样吧 -
02009-07-21 20:49:29@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
考虑要仔细。。。特殊情况应该拎出来特殊处理,0:0的情况也是要输出的。。数组开100000肯定够,再大就内存溢出了。。
嘿嘿。。我的程序比贴出来的都短。。不过规定说不可以我就不贴了。。 -
02009-07-21 15:09:31@
怎么没人贴C的 ?
-
02009-07-21 09:59:30@
对了一半,咋办
#include
using namespace std;
int main()
{
long w=0,l=0,i=0;
char a[100000];
while((a[i]=getchar())!='E')
i++;
for(i=0;i -
02009-07-17 16:42:23@
program p1217;
var i,j,k,l,s1,s2:longint;
st:string;
t:boolean;
a:array[0..1000000] of integer;begin
readln(st);
t:=true;
k:=0;
while t do
begin
l:=length(st);
for i:=1 to l do
begin
if st[i]='E' then
begin
t:=false;
break;
end;
if st[i]='W' then
begin
inc(k);
a[k]:=1;
end;
if st[i]='L' then
begin
inc(k);
a[k]:=0;
end;
end;
readln(st);
if st='' then t:=false;
end;s1:=0; s2:=0;
for i:=1 to k do
begin
if a[i]=1 then inc(s1) else inc(s2);
if (((s1>=11)or(s2>=11))and (abs(s1-s2)>=2)) then
begin
writeln(s1,':',s2);
s1:=0; s2:=0;
end;
end;
writeln(s1,':',s2);
s1:=0; s2:=0;writeln;
s1:=0; s2:=0;
for i:=1 to k do
begin
if a[i]=1 then inc(s1) else inc(s2);
if (((s1>=21)or(s2>=21))and (abs(s1-s2)>=2)) then
begin
writeln(s1,':',s2);
s1:=0; s2:=0;
end;
end;
writeln(s1,':',s2);
s1:=0; s2:=0;
end.先是数组开小了开成1000
然后得20分最后吸取教训了
结果如下:
编译通过...
├ 测试数据 01:答案错误... ├ 标准行输出
├ 错误行输出
├ 测试数据 02:答案错误... ├ 标准行输出
├ 错误行输出
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms然后提交来提交去 ~~~~(>___
-
02009-07-16 20:29:59@
一开始把数组开小了,结果WA了一次……
下一局没开打还0:0,让我又WA了一次…… -
02009-07-15 13:25:30@
由衷说一句:
这真是一道沙茶题!
我经过无数次WA之后才AC了
这题陷阱,细节太多了,很像初中化学!(至少我这么认为)
有148:...的
有5万个W的
有上来就E的
...................... -
02009-07-14 13:55:14@
program tabletennis;
var st:string[20];
i,j,l,h1,h2:integer;
t:boolean;
sta1:array[1..100,1..2]of 0..12;
sta2:array[1..100,1..2]of 0..22;
begin
t:=true;
for i:=1 to 100 do
for j:=1 to 2 do
begin
sta1:=0;
sta1:=0;
end;
h1:=1;
h2:=1;
while t do
begin
readln(st);
l:=length(st);
for i:=1 to l do
if (st[i]='W')or(st[i]='L')then
begin
if st[i]='W' then
begin
sta1:=sta1+1;
sta2:=sta2+1;
end
else if st[i]='L' then
begin
sta1:=sta1+1;
sta2:=sta2+1;
end;
if ((sta1>=11)or(sta1>=11))and (abs(sta1-sta1)>1) then h1:=h1+1;
if ((sta2>=21)or(sta2>=21))and (abs(sta2-sta2)>1) then h2:=h2+1;
end
else
begin
t:=false;
break;
end;
end;
for i:=1 to h1 do
for j:=1 to 2 do
begin
write(sta1 -
02009-07-09 19:41:08@
错误地认为11分制即进行11局,竟然得了50分
-
02009-07-08 13:10:37@
无聊的第十组数据,下一局比赛明明没开打,怎么能输出0:0呢?本以为避免了一个错误,谁知道一改反而错了
-
02009-07-07 18:01:14@
program pingpang;
var c:char;
a:array [1..1000000] of longint;
m,n,i,j,x,y:longint;
begin
m:=0; n:=0; x:=0; y:=0;
read(c);
if c='E' then
begin
writeln('0:0');
writeln;
writeln('0:0');
end
else
begin
i:=1;
while (c'E') do
begin
if c='W' then begin m:=m+1; x:=x+1; end;
if c='L' then begin n:=n+1; y:=y+1; end;
if (m>=11) or (n>=11)
then if ((m-n)>=2) or ((n-m)>=2) then
begin
writeln(m,':',n);
m:=0; n:=0;
end;
if (x>=21) or (y>=21)
then if ((x-y)>=2) or ((y-x)>=2) then
begin
a[i]:=x; a:=y;
x:=0; y:=0; i:=i+2;
end;
read(c);
end;
writeln(m,':',n);
a[i]:=x; a:=y;
writeln;
for j:=1 to ((i+1) div 2) do
writeln(a[(2*j)-1],':',a[2*j]);
end;
readln;
readln;
end. -
02009-08-22 20:50:50@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms首先鄙视这题:
1、没有标明数据范围:数组要开到60000以上
2、字符串是20个一行,有若干行读入的,注意审题啊
3、如果上一场刚打完,下一场没有开始也要输出0:0
4、所有的变量都开到longint最好鄙视完了,好孩子别往下看
program dogdogproblem;
var
s:string[30];
i,x,y,x1,y1,h:longint;
ans1,ans2:array[1..60000]of longint;
f:boolean;
begin
f:=true;
while f do
begin
readln(s);
for i:=1 to length(s) do
if s[i]'E'
then begin
case s[i] of
'W':begin inc(x); inc(x1); end;
'L':begin inc(y); inc(y1); end;
end;
if ((x>=11)or(y>=11))and(abs(x-y)>=2)
then begin
writeln(x,':',y);
x:=0;y:=0;
end;
if ((x1>=21)or(y1>=21))and(abs(x1-y1)>=2)
then begin
inc(h);
ans1[h]:=x1;
ans2[h]:=y1;
x1:=0; y1:=0;
end;
end
else begin
f:=false;
break;
end;
end;
writeln(x,':',y);
writeln;
for i:=1 to h do
writeln(ans1[i],':',ans2[i]);
writeln(x1,':',y1);
end. -
02009-05-28 21:47:21@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02009-05-27 20:42:02@
同志們啊
別在數據上吃虧啊
我開了個6000的數組
沒過
改成60000才過的所以強烈建議別偷懶
別用數組
多開幾個變量吧 -
02009-05-27 12:46:58@
var
ch:char;
s:ansistring;
i,l,x1,x2,z,y1,y2:longint;
begin
S:='';
repeat
read(ch);
if (ch='E')or(ch='W')or(CH='L')
then
s:=s+ch;
I:=I+1;
IF I MOD 20=0
THEN READLN;until ch='E';
l:=length(s);
for i:=1 to l do
begin
if s[i]='E'
then writeln(x1,':',x2);
if s[i]='W'
thenx1:=x1+1;
if s[i]='L' then x2:=x2+1;
if ((x1>=11)or(x2>=11))and(abs(x1-x2)>=2)
then begin writeln(x1,':',x2);x1:=0;x2:=0;end;end;
writeln;
l:=length(s);
for i:=1 to l do
begin
if s[i]='E'
then writeln(y1,':',y2);
if s[i]='W'
theny1:=y1+1;
if s[i]='L' then y2:=y2+1;
if ((y1>=21)or(y2>=21))and(abs(y1-y2)>=2)
then begin writeln(y1,':',y2);y1:=0;y2:=0;end;end;
end.