381 条题解
-
0
龙套 LV 3 @ 2009-04-22 13:37:25
为甚麽一直是Running?
#include
#include
main()
{
static int i,ce,ct,t1,t2,e1,e2,cel1[10000],cel2[10000],ctw1[10000],ctw2[10000];
char in;
while(in!='E'){
scanf("%c",&in);
if(in=='W') {
t1++;e1++;/*t1='twenty制' e=eleven制*/
if(e1==11) {ce++;cel1[ce]=11;cel2[ce]=e2;e1=0;e2=0;}
if(t1==21) {ct++;ctw1[ct]=21;ctw2[ct]=t2;t1=0;t2=0;}}
if(in=='L'){
t2++;e2++;
if(e2==11) {ce++;cel2[ce]=11;cel1[ce]=e1;e1=0;e2=0;}
if(t2==21) {ct++;ctw2[ct]=21;ctw1[ct]=t1;t1=0;t2=0;}
}
if(in=='E') {ce++;ct++;cel1[ce]=e1;cel2[ce]=e2;ctw1[ct]=t1;ctw2[ct]=t2;}
}
for(i=1;i -
02009-09-21 20:02:37@
这个。。为什么有一个点超时 Flag却是Accepted....
-
02009-03-15 11:24:13@
#include
using namespace std;
int bf[10000][2];
int bf2[10000][2];
main(){
char a;
int t1=0,t2=0;
int f1=0,f2=0;
int f12=0,f11=0;
a='a';
while(a!='e')
{
a=getchar();
if (a=='W') {
f11++;
f1++;
}
if (a=='L'){
f12++;
f2++;
}
if ((f1>=11||f2>=11)&&((f1-f2)>=2||(f2-f1)>=2)){
bf[t1][0]=f1;
bf[t1][1]=f2;
t1++;
//cout -
02009-03-02 17:09:17@
第一个数据: 【input 1】 EWLWLWL 【output 1】 0:0 0:0 【input 10】 WWWWWWWWWWWEadfadf;jadf 【output 10】 11:0 0:0 11:0 数据好狡猾!!!!!!!!!!!!!!!!
-
02009-02-27 21:36:44@
var
a,b:array[1..100000,1..2]of integer;
i,j,k,w1,w2,l1,l2:integer;
ch:char;
begin
w1:=0; w2:=0; l1:=0; l2:=0; i:=0; j:=0;
repeat
read(ch);
if ch='W' then begin inc(w1); inc(w2); end;
if ch='L' then begin inc(l1); inc(l2); end;
if (w1>10)and(l110)and(w120)and(l220)and(w2 -
02009-02-17 22:04:22@
哪位大哥能帮我改改?
program pingpong_ball;
var
a:array[1..50000] of char;
i,j,n,w,l:longint;
ch:char;
procedure reads;
begin
i:=1;
while ch'E' do begin
read(ch);
if ch='E' then exit;
while ch=' ' do read(ch);
a[i]:=ch;
inc(i);
end;
end;
begin
reads;
for j:=1 to i do
if (a[j]'W') and (a[j]'L')then a[j]:='A';
j:=1;
repeat
w:=0;l:=0;
while (((w=11)and(l-w=0)))and((a[j]='W') or (a[j]='L') or (a[j]='A')) do
begin
if a[j]='W' then inc(w);
if a[j]='L' then inc(l);
inc(j);
end;
writeln(w,':',l);
until (j>=i);
if ((w-l>=2)or (l-w>=2)) and ((w>=11) or (l>=11)) then writeln('0:0');
writeln;
j:=1;
repeat
w:=0;l:=0;
while (((w=21)and(l-w=0)))and((a[j]='W') or (a[j]='L') or (a[j]='A')) do
begin
if a[j]='W' then inc(w);
if a[j]='L' then inc(l);
inc(j);
end;
writeln(w,':',l);
until (j>=i);
if ((w-l>=2)or (l-w>=2)) and ((w>=21) or (l>=21)) then writeln('0:0');
end. -
02009-02-05 16:30:13@
pl
-
02009-02-03 13:40:51@
Var
e1,e2,t1,t2:array[1..1000000] of integer;
str:string;
i,e11,t21,a11,a21:longint;
Begin
readln(str);
e11:=1;t21:=1;
while str'' do
begin
if ((e1[e11]>=11) or (e2[e11]>=11)) and (abs(e1[e11]-e2[e11])>=2) then
inc(e11);
if ((t1[t21]>=21) or (t2[t21]>=21)) and (abs(t1[t21]-t2[t21])>=2) then
inc(t21);
if str[1]='E' then break;
if str[1]='W' then begin inc(e1[e11]);inc(t1[t21]);end;
if str[1]='L' then begin inc(e2[e11]);inc(t2[t21]);end;
delete(str,1,1);
if str='' then readln(str);
end;
for i:=1 to e11 do
writeln(e1[i],':',e2[i]);
writeln;
for i:=1 to t21 do
writeln(t1[i],':',t2[i]);
End.++++++++++++++++++++++++++++++++++++++++++++++++++++++
鄙视不喜欢运动的人么?囧!
-
02009-01-31 00:13:16@
分差>=2才行………… -_-!!!!!!!!
-
02009-01-28 21:42:55@
#include
using namespace std;
int main (void)
{
string s,a;
int i,j=0,p,p1=1;
while (p1)
{
cin>>a;
p=a.size();
for (i=0;i -
02009-01-22 09:47:39@
zhedaotiwofangqile
-
02009-01-09 18:38:04@
#include
#include
using namespace std;void out_sc(string&sc,int&w,int&l) {
char n[3];
_itoa(w,n,10);
(sc+=n)+=':';
_itoa(l,n,10);
(sc+=n)+='\n';
w=l=0;
}int main() {
char c;
int _11w=0,_11l=0,_21w=0,_21l=0;
string _11sc,_21sc;
while(1) {
while((c=cin.get())!='W'&&c!='L'&&c!='E');
switch(c) {
case 'W':
_11w++,_21w++;
if(_11w>=11&&_11w-_11l>=2) out_sc(_11sc,_11w,_11l);
if(_21w>=21&&_21w-_21l>=2) out_sc(_21sc,_21w,_21l);
break;
case 'L':
_11l++,_21l++;
if(_11l>=11&&_11l-_11w>=2) out_sc(_11sc,_11w,_11l);
if(_21l>=21&&_21l-_21w>=2) out_sc(_21sc,_21w,_21l);
break;
case 'E':
out_sc(_11sc,_11w,_11l);
out_sc(_21sc,_21w,_21l);
cout -
02009-10-05 16:59:07@
吐血…………
好好的代码提交上去就乱了…………无语!原来的代码:
#include using namespace std;short a=0,b=0,sco11[10000][2],sco21[10000][2];int abss(int x) { return x>0?x:-x; }//abssvoid pd () { if ((sco11[a][0]>=11||sco11[a][1]>=11)&&abss(sco11[a][0]-sco11[a][1])>1) a++; if ((sco21[0]>=21||sco21[1]>=21)&&abss(sco21[0]-sco21[1])>1) b++; }//pdvoid hua() { sco11[a][0]++;sco21[0]++; pd(); }//huavoid dui() { sco11[a][1]++;sco21[1]++; pd(); }//huaint main () { int i; char c; sco11[0][0]=sco11[0][1]=sco21[0][0]=sco21[0][1]=0; while (c=getchar()) { if (c=='E') break; else if (c=='W') hua(); else if (c=='L') dui(); }//while for (i=0;i0||sco11[i][1]>0) printf("%d:%d\n",sco11[i][0],sco11[i][1]); putchar('\n'); for (i=0;i0||sco21[i][1]>0) printf("%d:%d\n",sco21[i][0],sco21[i][1]); return 0; }//main
提交后显示的代码:
#include using namespace std;short a=0,b=0,sco11[10000][2],sco21[10000][2];int abss(int x) { return x>0?x:-x; }//abssvoid pd () { if ((sco11[a][0]>=11||sco11[a][1]>=11)&&abss(sco11[a][0]-sco11[a][1])>1) a++; if ((sco21[0]>=21||sco21[1]>=21)&&abss(sco21[0]-sco21[1])>1) b++; }//pdvoid hua() { sco11[a][0]++;sco21[0]++; pd(); }//huavoid dui() { sco11[a][1]++;sco21[1]++; pd(); }//huaint main () { int i; char c; sco11[0][0]=sco11[0][1]=sco21[0][0]=sco21[0][1]=0; while (c=getchar()) { if (c=='E') break; else if (c=='W') hua(); else if (c=='L') dui(); }//while for (i=0;i0||sco11[i][1]>0) printf("%d:%d\n",sco11[i][0],sco11[i][1]); putchar('\n'); for (i=0;i0||sco21[i][1]>0) printf("%d:%d\n",sco21[i][0],sco21[i][1]); return 0; }//main
无语…………写在题解上都乱了…………什么VJ啊-_-~~! -
02008-12-25 20:08:08@
破题!降低我老多正确率!
program p1217;
var
t:char;
st:array[1..100000] of char;
len:longint;procedure clear(var a,b:longint);
begin
a:=0;
b:=0;
end;procedure compete(m:integer);
var
i,a,b:longint;
begin
clear(a,b);
for i:=1 to len do
begin
if st[i]='W' then inc(a);
if st[i]='L' then inc(b);
if ((a=m) and (bm) and ((b-a)=2) then
begin
writeln(a,':',b);
clear(a,b);
end;
end;
writeln(a,':',b);
end;begin
read(t);
while t'E' do
begin
inc(len);
st[len]:=t;
read(t);
end;
if len=0 then
begin
writeln('0:0');
writeln;
writeln('0:0');
end
else
begin
compete(11);
writeln;
compete(21);
end;
end. -
02008-12-18 18:21:09@
哪个老大帮我看看哪里错了
program pipadf;
var s:string;
a,b:longint;
i,j,k,n,m:integer;
ch:char;
begin
read(ch);
while ch'E' do
begin
s:=s+ch;
read(ch);
end;
m:=length(s);
for i:=1 to m do
begin
if s[i]='W' then a:=a+1;
if s[i]='L' then b:=b+1;
if ((a>=11 ) or (b>=11)) and (abs(a-b)>=2) then
begin
writeln(a,':',b);
a:=0;b:=0;
end;
end;
writeln(a,':',b) ;
writeln;
a:=0;b:=0;
for i:=1 to m do
begin
if s[i]='W' then a:=a+1;
if s[i]='L' then b:=b+1;
if ((a>=21 ) or (b>=21)) and (abs(a-b)>=2) then
begin
writeln(a,':',b);
a:=0;b:=0;
end;
end;
writeln(a,':',b) ;
end. -
02008-12-21 02:03:12@
#include
#include
using namespace std;void out_sc(string&sc,int&w,int&l) {
char n[3];
_itoa(w,n,10);
(sc+=n)+=':';
_itoa(l,n,10);
(sc+=n)+='\n';
w=l=0;
}int main() {
char c;
int _11w=0,_11l=0,_21w=0,_21l=0;
string _11sc,_21sc;
while(1) {
while((c=cin.get())!='W'&&c!='L'&&c!='E');
switch(c) {
case 'W':
_11w++,_21w++;
if(_11w>=11&&_11w-_11l>=2) out_sc(_11sc,_11w,_11l);
if(_21w>=21&&_21w-_21l>=2) out_sc(_21sc,_21w,_21l);
break;
case 'L':
_11l++,_21l++;
if(_11l>=11&&_11l-_11w>=2) out_sc(_11sc,_11w,_11l);
if(_21l>=21&&_21l-_21w>=2) out_sc(_21sc,_21w,_21l);
break;
case 'E':
out_sc(_11sc,_11w,_11l);
out_sc(_21sc,_21w,_21l);
cout -
02008-12-14 13:20:49@
var
n,l:integer;
s:string;
procedure tabletennis(d,r:integer);{d:局制,r:n}
var
i,j,k:integer;
begin
k:=0; i:=0; j:=0;
repeat
inc(i);
if s[i]='W' then inc(k);
if s[i]='L' then inc(j);
if i mod d=0 then{判断一局是否结束}
begin
writeln(k,':',j);{打印本局比分}
k:=0; j:=0;{计数器清零}
end;
until i=r;{s算完}
if (k0)or(j0) then writeln(k,':',j);{如果有半局情况则输出}
end;
begin
readln(s);
if s[1]='E' then
begin writeln(0,':',0); writeln; writeln(0,':',0); exit; end;
for l:=1 to length(s) do
if s[l]='E' then break else inc(n);{计算有效长度}
tabletennis(11,n);
writeln;
tabletennis(21,n);
readln;
end. -
02008-12-07 13:28:36@
var
a,b:array[1..1000000]of char;
i,j,k,f,n,m:longint;
s:string;
begin
i:=1;
n:=0;
m:=0;
j:=1;
repeat
read(a[i]);
if (a[i]='W')or(a[i]='L')
then inc(i);
until a[i]='E';repeat
if a[j]='W'
then inc(n);
if a[j]='L'
then inc(m);
if ((m>=11)or(n>=11))and(abs(n-m)>=2)
then begin
writeln(n,':',m);
n:=0;
m:=0;
end;inc(j);
until j>i;
writeln(n,':',m);
writeln;n:=0;
m:=0;
j:=1;
repeat
if a[j]='W'
then inc(n);
if a[j]='L'
then inc(m);
if ((m>=21)or(n>=21))and(abs(n-m)>=2)
then begin
writeln(n,':',m);
n:=0;
m:=0;
end;inc(j);
until j>i;
writeln(n,':',m);end.
-
02008-12-06 16:11:15@
这道题……为什么不给数据范围?!
提醒广大后来者,要开ansistring和longint,数组也要开大
而且有一个数据只输入E一个字符,此时要输出
0:00:0
-
02008-11-22 21:09:27@
难得的AC...
program table;
var s:array[1..100000]of char;
ch:char;
i,hua,dui,n:longint;
t,z,m:boolean;
begin
i:=0;
repeat
begin
hua:=0; dui:=0; t:=false; z:=false; m:=false;
repeat
begin
inc(i);
read(s[i]);
if s[i]='W' then begin inc(hua); end;
if s[i]='L' then begin inc(dui); end;
if (hua>=10) and (dui=hua+1) then t:=true;
if (dui>=10) and (hua=dui+1) then t:=true;
if (hua>=10) and (dui=hua+2) then m:=true;
if (dui>=10) and (hua=dui+2) then m:=true;
if (hua=11) or (dui=11) then z:=true;
end;
until ((z=true) and (t=false)) or (s[i]='E') or (m=true);
writeln(hua,':',dui);
end;
until s[i]='E';
writeln; i:=0;
repeat
begin
hua:=0; dui:=0; t:=false; z:=false; m:=false;
repeat
begin
inc(i);
if s[i]='W' then begin inc(hua); end;
if s[i]='L' then begin inc(dui); end;
if (hua>=20) and (dui=hua+1) then t:=true;
if (dui>=20) and (hua=dui+1) then t:=true;
if (hua>=20) and (dui=hua+2) then m:=true;
if (dui>=20) and (hua=dui+2) then m:=true;
if (hua=21) or (dui=21) then z:=true;
end;
until ((z=true) and (t=false)) or (s[i]='E') or (m=true);
writeln(hua,':',dui);
end;
until s[i]='E';
end.