508 条题解
-
0Lionheart LV 6 @ 2008-10-26 16:53:17
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02008-10-23 19:17:59@
program ex;
var
n,i,j,k,step,step1:longint;
pinjun,pinyi,lunwen:longint;
st:string;
a:array[1..108,1..6]of string;
b:array[1..108,1..2]of longint;
//=====================================
procedure init;
begin
readln(n);
fillchar(b,sizeof(b),0);
for i:=1 to n do
begin
readln(st);
step:=0;
step1:=1;
for j:=1 to length(st) do
if st[j]=' '
then begin
inc(step);
a:=copy(st,step1,j-step1);
step1:=j+1;
end;
a:=copy(st,step1,j-step1+1);
end;
{ for i:=1 to n do
begin
for j:=1 to 6 do
write(a,' ');
writeln;
end; }
end;
//======================================
procedure jisuan;
begin
for i:=1 to n do
begin
b:=i;
val(a,pinjun);
val(a,pinyi);
val(a,lunwen);
if (pinjun>80)and(lunwen>=1)
then inc(b,8000);
if (pinjun>85)and(pinyi>80)
then inc(b,4000);
if (pinjun>90)
then inc(b,2000);
if (pinjun>85)and(a='Y')
then inc(b,1000);
if (pinyi>80)and(a='Y')
then inc(b,850);
end;
end;
//======================================
procedure pa;
begin
for i:=1 to n-1 do
for j:=i+1 to n do
if b -
02008-10-22 19:49:05@
#include
using namespace std;
long n,sum,i,j,k,t,map[100]={0};
char name[100][20],ins,sur;
int main(){
cin>>n;
sum=0;
for(i=0;i>name[i]>>j>>k>>ins>>sur>>t;
if(j>80&&t>=1) map[i]+=8000;
if(j>85&&k>80) map[i]+=4000;
if(j>90) map[i]+=2000;
if(j>85&&sur=='Y') map[i]+=1000;
if(k>80&&ins=='Y') map[i]+=850;
sum+=map[i];
}
j=0;
for(i=1;imap[j]) j=i;
cout -
02008-10-22 19:23:36@
type
rec=record
name:string;
qm:longint;
bj:longint;
xg:boolean;
xb:boolean;
lw:boolean;
so:longint;
end;
var
r:array [1..1000] of rec;
max:rec;
n,i,j:integer;
m:longint;
str:string;
begin
readln(n);
for i:=1 to n do
begin
readln(str);
r[i].name:=copy(str,1,pos(' ',str)-1);
delete(str,1,pos(' ',str));
while str[1]' ' do begin r[i].qm:=r[i].qm*10+ord(str[1])-ord('0');delete(str,1,1);end;
delete(str,1,1);
while str[1]' ' do begin r[i].bj:=r[i].bj*10+ord(str[1])-ord('0');delete(str,1,1);end;
delete(str,1,1);
if str[1]='Y' then r[i].xg:=true else r[i].xg:=false;
if str[3]='Y' then r[i].xb:=true else r[i].xb:=false;
delete(str,1,4);
if (ord(str[1])-ord('0')>=1) then r[i].lw:=true else r[i].lw:=false;
r[i].so:=0;
end;
m:=0;
max:=r[1];
for i:=1 to n do
begin
r[i].so:=0;
if (r[i].bj>80) and (r[i].xg) then inc(r[i].so,850);
if (r[i].qm>85) and (r[i].xb) then inc(r[i].so,1000);
if r[i].qm>90 then inc(r[i].so,2000);
if (r[i].qm>85) and (r[i].bj>80) then inc(r[i].so,4000);
if (r[i].qm>80) and (r[i].lw) then inc(r[i].so,8000);
if (r[i].so)>max.so then max:=r[i];
inc(m,r[i].so);
end;
writeln(max.name);
writeln(max.so);
writeln(m);
end.
用记录数组不就OK了....麻烦个啥 -
02008-10-19 21:18:18@
program vp1001;
type
student=record
name:string[20];
sorce:integer;
pi:integer;
xg:string;
xs:string;
lw:integer;
jj:integer
end;
var
st:array [1..100] of student;
i,n,max,j,t:integer;
begin
read(n);
for i:=1 to n do
begin
readln(st[i].name);
readln(st[i].sorce,st[i].pi);
readln(st[i].xg);
readln(st[i].xs);
readln(st[i].lw)
end;
{with st[i] do
begin
readln(name);
readln(sorce,pi);
readln(xg);
readln(xs);
readln(lw)
end; }
for i:=1 to n do
st[i].jj:=0;
for i:=1 to n do
begin
if (st[i].sorce>80) and (st[i].lw>=1)
then
st[i].jj:=8000+st[i].jj;
if (st[i].sorce>85) and (st[i].pi>80)
then
st[i].jj:=4000+st[i].jj;
if st[i].sorce>90
then
st[i].jj:=st[i].jj+2000;
if (st[i].sorce>85) and (st[i].xs='y')
then
st[i].jj:=st[i].jj+1000;
if (st[i].pi>80) and (st[i].xs='y')
then
st[i].jj:=st[i].jj+850
end;
for i:=1 to n-1 do
for j:=2 to n do
if st[i].jj>st[j].jj
then
begin
t:=st[j].jj;
st[j].jj:=st[i].jj;
st[i].jj:=t
end;
writeln(st[n].name);
writeln(st[n].jj);
max:=0;
for i:=1 to n do
max:=max+st[i].jj;
writeln(max)
end.
真是搞不懂 如此天书式解题竟然通不过 -
02008-10-19 11:52:18@
这里涉及到的就是记录不用也可以,输入数据的字符串处理,求最大值。
-
02008-10-19 08:27:54@
Program P1001;
Type rec=record
all,name,w,c:string;
s,e,p:integer;
end;
Var
n,i,j,maxN,money,total:longint;
cop,maxP:string;
a:array[1..100] of rec;Begin
maxN:=0;
total:=0;
j:=0;readln(n);
For i:=1 to n do begin
readln(a[i].all);
while pos(' ',a[i].all)0 do begin
j:=j+1;
cop:=copy(a[i].all,1,pos(' ',a[i].all)-1);
case j of
1: a[i].name:=cop;
2: val(cop,a[i].s);
3: val(cop,a[i].e);
4: a[i].c:=cop;
5: a[i].w:=cop;
end;
delete(a[i].all,1,pos(' ',a[i].all));
if pos(' ',a[i].all)=0 then val(a[i].all,a[i].p);
end;j:=0;
If (a[i].s>80) and (a[i].p>=1) then money:=8000;
If (a[i].s>85) and (a[i].e>80) then money:=money+4000;
If (a[i].s>90) then money:=money+2000;
If (a[i].s>85) and ((a[i].w='Y') or (a[i].w='y')) then money:=money+1000;
If (a[i].e>80) and ((a[i].c='Y') or (a[i].c='y')) then money:=money+850;
If (MaxN=0) or (money>MaxN) then begin
MaxN:=money;
MaxP:=a[i].name;
end;
Total:= Total + money ;
money:=0;
End;Writeln(Maxp);
Writeln(Maxn);
Writeln(total);
End. -
02008-10-15 21:16:04@
#include
using namespace std;struct stu
{
char name[25];
int final;
int group;
char leader;
char west;
int acd;
int scol;
};stu scolar[100];
int main()
{
int n;
cin>>n;
stu max;
max.scol=-1;
double total=0;
int i;
for(i=0;i>scolar[i].name>>scolar[i].final>>scolar[i].group>>scolar[i].leader>>scolar[i].west>>scolar[i].acd;
scolar[i].scol=0;
if(scolar[i].final>80&&scolar[i].acd>=1)
{
scolar[i].scol+=8000;
}
if(scolar[i].final>85&&scolar[i].group>80)
scolar[i].scol+=4000;
if(scolar[i].final>90)
scolar[i].scol+=2000;
if(scolar[i].final>85&&scolar[i].west=='Y')
scolar[i].scol+=1000;
if(scolar[i].group>80&&scolar[i].leader=='Y')
scolar[i].scol+=850;if(scolar[i].scol>max.scol)
{
max.scol=scolar[i].scol;
strcpy(max.name,scolar[i].name);
}
total+=scolar[i].scol;}
printf("%s\n%d\n%.0lf",max.name,max.scol,total);}
-
02008-10-15 15:47:29@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02008-10-14 20:27:33@
注意如果最大值不唯一只输出第一个
汗~~
死在这里了 -
02008-10-11 13:36:49@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02008-10-11 11:20:51@
type rec=record
name:string;
m1,m2,sum:longint;
c1,c2:char;
m:byte;
end;
var
a:array[1..100] of rec;
i,j,k,n,ans,max:longint;
c:char;
begin
readln(n);
for i:=1 to n do begin
read(c);
while c' ' do begin
a[i].name:=a[i].name+c;
read(c)
end;
read(a[i].m1);
read(a[i].m2);
read(c);
read(a[i].c1);
read(c);
read(a[i].c2);
read(a[i].m);
readln;
end;
for i:=1 to n do begin
if (a[i].m1>80) and (a[i].m>0) then begin
a[i].sum:=a[i].sum+8000;
ans:=ans+8000;
end;
if (a[i].m1>85) and (a[i].m2>80) then begin
a[i].sum:=a[i].sum+4000;
ans:=ans+4000;
end;
if a[i].m1>90 then begin
a[i].sum:=a[i].sum+2000;
ans:=ans+2000;
end;
if (a[i].m1>85) and (a[i].c2='Y') then begin
a[i].sum:=a[i].sum+1000;
ans:=ans+1000;
end;
if (a[i].m2>80) and (a[i].c1='Y') then begin
a[i].sum:=a[i].sum+850;
ans:=ans+850;
end;
end;
max:=0;
for i:=1 to n do
if a[i].sum>max then begin
k:=i;
max:=a[i].sum;
end;
writeln(a[k].name);
writeln(max);
writeln(ans);
end. -
02008-10-10 21:59:15@
Program P1001;
Type rec=record
all,name,w,c:string;
s,e,p:integer;
end;
Var
n,i,j,maxN,money,total:longint;
cop,maxP:string;
a:array[1..100] of rec;Begin
maxN:=0;
total:=0;
j:=0;readln(n);
For i:=1 to n do begin
readln(a[i].all);
while pos(' ',a[i].all)0 do begin
j:=j+1;
cop:=copy(a[i].all,1,pos(' ',a[i].all)-1);
case j of
1: a[i].name:=cop;
2: val(cop,a[i].s);
3: val(cop,a[i].e);
4: a[i].c:=cop;
5: a[i].w:=cop;
end;
delete(a[i].all,1,pos(' ',a[i].all));
if pos(' ',a[i].all)=0 then val(a[i].all,a[i].p);
end;j:=0;
If (a[i].s>80) and (a[i].p>=1) then money:=8000;
If (a[i].s>85) and (a[i].e>80) then money:=money+4000;
If (a[i].s>90) then money:=money+2000;
If (a[i].s>85) and ((a[i].w='Y') or (a[i].w='y')) then money:=money+1000;
If (a[i].e>80) and ((a[i].c='Y') or (a[i].c='y')) then money:=money+850;
If (MaxN=0) or (money>MaxN) then begin
MaxN:=money;
MaxP:=a[i].name;
end;
Total:= Total + money ;
money:=0;
End;Writeln(Maxp);
Writeln(Maxn);
Writeln(total);
End.好像我方法有点不一样~~~
-
02008-10-06 16:51:56@
type rec=record
name:string;
m1,m2,sum:longint;
c1,c2:char;
m:byte;
end;
var
a:array[1..100] of rec;
i,j,k,n,ans,max:longint;
c:char;
begin
readln(n);
for i:=1 to n do begin
read(c);
while c' ' do begin
a[i].name:=a[i].name+c;
read(c)
end;
read(a[i].m1);
read(a[i].m2);
read(c);
read(a[i].c1);
read(c);
read(a[i].c2);
read(a[i].m);
readln;
end;
for i:=1 to n do begin
if (a[i].m1>80) and (a[i].m>0) then begin
a[i].sum:=a[i].sum+8000;
ans:=ans+8000;
end;
if (a[i].m1>85) and (a[i].m2>80) then begin
a[i].sum:=a[i].sum+4000;
ans:=ans+4000;
end;
if a[i].m1>90 then begin
a[i].sum:=a[i].sum+2000;
ans:=ans+2000;
end;
if (a[i].m1>85) and (a[i].c2='Y') then begin
a[i].sum:=a[i].sum+1000;
ans:=ans+1000;
end;
if (a[i].m2>80) and (a[i].c1='Y') then begin
a[i].sum:=a[i].sum+850;
ans:=ans+850;
end;
end;
max:=0;
for i:=1 to n do
if a[i].sum>max then begin
k:=i;
max:=a[i].sum;
end;
writeln(a[k].name);
writeln(max);
writeln(ans);
end.
天啊,这水题我居然用了半个小时,和小学生一个水平,悲哀啊~~~~~~~~ -
02008-10-05 21:07:42@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
小学生就用记录类型+字符串搞了半个小时AC。 -
02008-09-29 15:11:47@
var total,i,j,k,l,m,n,b,c:longint;
s,name:array[0..101] of string;
money,rmb:array[0..101] of longint;
flag1,flag2:array[0..101] of boolean;
temp:string;
a:longint;procedure qsort(l,r:longint);
var i,j,k,x:longint;
begin
i:=l;j:=r;x:=money[(i+j) div 2];
repeat
while money[i]x do dec(j);
if ij;
if i80) and (a>85) then money[i]:=money[i]+4000;
delete(s[i],1,k);
temp:=s;
if (temp='Y') and (b>80) then money[i]:=money[i]+850;
delete(s[i],1,2);
temp:=s;
if (temp='Y') and (a>85) then money[i]:=money[i]+1000;
delete(s[i],1,2);
temp:=s;
val(temp,c,l);
if (c>=1) and (a>80) then money[i]:=money[i]+8000;
end;
for i:=1 to n do begin
rmb[i]:=money[i];
total:=total+money[i];
end;
qsort(1,n);
for i:=1 to n do
if rmb[i]=money[n] then begin
writeln(name[i]);
writeln(rmb[i]);
writeln(total);
break;
end;
close(input);close(output);
end.
快排+字符串处理 -
02008-09-21 14:01:10@
#include
int main(){
int i,j,n,qm,py,lw,prize,max=0;
long total=0;
char a[20],name[20],xb,gb;
scanf("%d",&n);
for(i=1;i80)&&(lw>0)) prize+=8000;
if((qm>85)&&(py>80)) prize+=4000;
if(qm>90) prize+=2000;
if((qm>85)&&(xb=='Y')) prize+=1000;
if((py>80)&&(gb=='Y')) prize+=850;
total+=prize;
if(prize>max){
max=prize;
for(j=0;j -
02008-09-18 19:49:20@
program money;
var w,f,d:char; k,len,n,i,j,temp2,sum:integer; temp1:longint;
a:array [1..100,1..5] of longint;
b:array [1..100,1..2] of char;
c:array [1..100] of string;
temp3,e:string;
procedure se;
begin
if ((a>=80) and (a>0)) then a:=a+8000;
if ((a>=85) and (a>=80)) then a:=a+4000;
if (a>=90) then a:=a+2000;
if ((a>=85) and ((b='Y') or (b='y'))) then a:=a+1000;
if ((a>=80) and ((b='Y')or (b='y'))) then a:=a+850;
end;
begin
fillchar(a,sizeof(a),0);
readln(n);
for i:=1 to n do
begin
repeat
read(w);
if w' ' then c[i]:=c[i]+w;
until w=' ';
readln(a,a,f,b,d,b,a);
a:=i;
end;
for i:=1 to n do se;
for i:=1 to n-1 do
for j:=i+1 to n do
if ((aa))) then
begin
temp1:=a;
a:=a[j,4];
a[j,4]:=temp1;
temp2:=a;
a:=a[j,5];
a[j,5]:=temp2;
temp3:=c[i];
c[i]:=c[j];
c[j]:=temp3;
end;
sum:=0;
for i:=1 to n do sum:=sum+a;
writeln(c[1]);
writeln(a[1,4]);
writeln(sum);
end.
为什么错误啊? -
02008-09-12 21:17:05@
1读入数据2看符合条件的人可以得到得奖学金3输出得最大奖学金的人
-
02008-09-09 23:38:45@
这种水题需要的果然就是时间,去年在这卡了6次后GIVE UP,然后VIJOS就挂了。。。今年来一看。。。
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
5) 班级贡献奖,每人850元,班级评议成绩高于80分(>80)的学生干部均可获得;
这里的班级评议成绩看成平均成绩了。。。靠,一道真正做了一年的题就这样解决了。