508 条题解
-
0crarts LV 3 @ 2009-02-04 07:09:22
nehalem
#include
using namespace std;struct student
{
char name[20];
float qimo;
float pingyi;
char gb;
bool gbd;
char xb;
bool xbd;
int fab;
int total;
}stu[101];int n,i;
int a,b,c;
void in()
{
cin>>n;
for(i=1;i>stu[i].name>>stu[i].qimo>>stu[i].pingyi>>stu[i].gb>>stu[i].xb>>stu[i].fab;
}int main()
{
in();
for(i=1;i0) stu[i].total=stu[i].total+8000;
if(stu[i].qimo>85&&stu[i].pingyi>80) stu[i].total=stu[i].total+4000;
if(stu[i].qimo>90) stu[i].total=stu[i].total+2000;
if(stu[i].qimo>85&&stu[i].xb=='Y') stu[i].total=stu[i].total+1000;
if(stu[i].pingyi>80&&stu[i].gb=='Y') stu[i].total=stu[i].total+850;
}
int he=0;
for(i=1;i -
02009-02-03 15:45:11@
#include
using namespace std;struct student
{
char name[20];
float qimo;
float pingyi;
char gb;
bool gbd;
char xb;
bool xbd;
int fab;
int total;
}stu[101];int n,i;
int a,b,c;
void in()
{
cin>>n;
for(i=1;i>stu[i].name>>stu[i].qimo>>stu[i].pingyi>>stu[i].gb>>stu[i].xb>>stu[i].fab;
}int main()
{
in();
for(i=1;i0) stu[i].total=stu[i].total+8000;
if(stu[i].qimo>85&&stu[i].pingyi>80) stu[i].total=stu[i].total+4000;
if(stu[i].qimo>90) stu[i].total=stu[i].total+2000;
if(stu[i].qimo>85&&stu[i].xb=='Y') stu[i].total=stu[i].total+1000;
if(stu[i].pingyi>80&&stu[i].gb=='Y') stu[i].total=stu[i].total+850;
}
int he=0;
for(i=1;i -
02009-01-29 21:16:21@
简单的字符串处理……12th
-
02009-01-29 16:45:36@
#include
struct stu
{
char name[20];
int a;
int b;
char c;
char d;
int e;
int f;
}student[100];
int main(void)
{
int i,j,max,s,n,sum;
j=0,sum=0;
scanf("%d",&n);
for(i=0;i0)
s=s+8000;
if(student[i].a>85&&student[i].b>80)
s=s+4000;
if(student[i].a>90)
s=s+2000;
if(student[i].a>85&&student[i].d=='Y')
s=s+1000;
if(student[i].b>80&&student[i].c=='Y')
s=s+850;
student[i].f=s;
sum=sum+s;
}
max=student[0].f;
for(i=1;i -
02009-01-28 23:00:34@
program abc;
var k,l,q,u,p,m,i,j,t:integer;
a:array[1..100] of string;
b:array[1..100] of integer;
c:array[1..100] of integer;
d:array[1..100] of string;
e:array[1..100] of string;
z:array[1..100] of integer;
s:array[1..100] of integer;
o:text;
begin
assign (o,'a.out');
readln(m);
for j:=1 to m do
read(a[j],b[j],c[j],d[j],e[j],z[j]);for k:=1 to m do
begin
if (b[i]>80) and (z[i]>=1) then s[i]:=s[i]+8000;
if (b[i]>85) and (c[i]>80) then s[i]:=s[i]+4000;
if b[i]>90 then s[i]:=s[i]+2000;
if (b[i]>85) and (e[i]='Y') then s[i]:=s[i]+1000;
if (c[i]>80) and (d[i]='Y') then s[i]:=s[i]+850;
end;for l:=1 to m do
for q:=l+1 to m do
if s[l] -
02009-01-24 21:14:50@
关键是读取学生材料的那一行对字符读取和数字读取的区别.对数据来说空隔是读下一个数.对字符来说,空隔本身是个字符.
-
02009-01-21 13:54:18@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms#include
#include
using namespace std;struct student{
string name;
int score_final;
int score_usual;
char cadre;
char western;
int paper;
int scholar;
};void yuanshi(student &stu);
void wusi(student &stu);
void chengji(student &stu);
void xibu(student &stu);
void banji(student &stu);int main()
{
int n,i,max = 0,sum = 0;
cin>>n;
student stu[n];
for(i = 0; i < n; i++)
{
cin>>stu[i].namestu[i].score_final
stu[i].score_usual
stu[i].cadre
stu[i].western
stu[i].paper;
stu[i].scholar = 0;//计算奖学金
yuanshi(stu[i]);
wusi(stu[i]);
chengji(stu[i]);
xibu(stu[i]);
banji(stu[i]);//找到最大奖学金及奖学金总额
sum += stu[i].scholar;
if(stu[i].scholar > stu[max].scholar)
max = i;
}
cout -
02009-01-19 19:07:27@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msprogram p16;
var a,b:string;
e,f,i,j:longint;
d:char;function js(var a2:string):longint;
var cost,b2,b3,b4,b5,b6,b7,b8:longint; {qi mo pingjun chengji:b4}
c1,c2,c3:char; {c1:gb c2:west}
a3:string; {banji ping yi chengji:b5 b6:lun wen shu}
begin
cost:=0;
b8:=0;
b2:=1;
repeat
b2:=b2+1;
until ord(a2[b2])=32;
b2:=b2+1;
b3:=b2;
while (ord(a2[b3])32) do b3:=b3+1;
a3 := copy(a2, b2, b3-b2);
val(a3,b4,b8);
b3 := b3+1;
b2:=b3;
while (ord(a2[b3])32) do b3 := b3 +1;
a3 := copy(a2,b2,b3-b2);
val(a3,b5,b8);
b3:=b3+1;
c1:=a2[b3];
c2:=a2[b3+2];
b3:=b3+4;
b2:=b3;
if (ord(a2[b3+1])=48) then begin
a3 := copy(a2,b3,2);
val(a3,b6,b8);
end
else begin
a3 := copy(a2,b3,1);
val(a3,b6,b8);
end;
if (b5>80)and(c1='Y') then cost := cost+850;
if (b4>85)and(c2='Y') then cost := cost+1000;
if (b4>90) then cost := cost+2000;
if (b4>85)and(b5>80) then cost := cost+4000;
if (b4>80)and(b6>=1) then cost := cost+8000;
js := cost;
end;
begin
readln(e);
readln(a);
f:=f+js(a);
for j := 2 to e do begin
readln(b);
f:=f+js(b);
if js(b)>js(a) then a := b;
end;
j := 1;
while ord(a[j])32 do begin
write(a[j]);
j:=j+1;
end;
writeln;
writeln(js(a));
write(f);
end. -
02009-01-11 19:15:31@
program p1001;
varname:array [1..100] of string;
res:array [1..100,1..2] of integer;
oth:array [1..100,1..2] of char;
lun:array [1..100] of integer;
tot:array [1..100] of integer;
n,i,max,number:integer;
ch,f1,f2:char;
sum:longint;
begin
read(n);
for i:=1 to n do
beginread(ch);
while ch' ' do
begin
name[i]:=name[i]+ch;
read(ch);
end;
readln(res,res,f1,oth,f2,oth,lun[i]);
end;for i:=1 to n do
tot[i]:=0;
for i:=1 to n do
begin
if (res>80)and(lun[i]0) then tot[i]:=tot[i]+8000;
if (res>85)and(res>80) then tot[i]:=tot[i]+4000;
if (res>90) then tot[i]:=tot[i]+2000;
if (oth='Y')and(res>85) then tot[i]:=tot[i]+1000;
if (oth='Y')and(res>80) then tot[i]:=tot[i]+850;
end;
sum:=0;
for i:=1 to n do
sum:=sum+tot[i];
max:=0;
for i:=1 to n do
if max -
02009-01-10 10:12:34@
program vip1001(input,output);
var
n:integer;
star:string;
mony:array[1..1000]of longint;
infor:array[1..100,1..6]of string;
infor2:array[1..100,1..3]of integer;
i,j,max,min,k:longint;
begin
{assign(input,'vip1001.in');
assign(output,'vip1001.out');
reset(input);
rewrite(output);}
readln(n);for i:=1 to n do
begin
readln(star);
for j:=1 to 6 do
begin
infor[i][j]:=copy(star,1,pos(' ',star)-1);
delete(star,1,pos(' ',star));
if j=6
then infor[i][j]:=copy(star,1,length(star));
end;
end;for i:=1 to n do
begin
val(infor[i][2],infor2[i][1]);
val(infor[i][3],infor2[i][2]);
val(infor[i][6],infor2[i][3]);
end;
fillchar(mony,sizeof(mony),0);
for i:=1 to n do
begin
if (infor2[i][1]>80) and (infor2[i][3]>=1)
then mony[i]:=mony[i]+8000;
if (infor2[i][1]>85) and (infor2[i][2]>80)
then mony[i]:=mony[i]+4000;
if infor2[i][1]>90
then mony[i]:=mony[i]+2000;
if (infor2[i][1]>85) and (infor[i][5]='Y')
then mony[i]:=mony[i]+1000;
if (infor2[i][2]>80) and (infor[i][4]='Y')
then mony[i]:=mony[i]+850;
end;min:=0;
max:=-maxint;
for i:=1 to n do
min:=min+mony[i];for i:=1 to n do
if mony[i]>max
then begin max:=mony[i];k:=i;end;
writeln(infor[k][1]);
writeln(mony[k]);
writeln(min);end.
AC了 原来'100' -
02009-01-06 17:07:30@
#inlclude
using namespace std;
int main()
{int *p1,*p2,*p,a,b;
cin>>a>>b;
p1=&a;
p2=&b;
if(a -
02009-01-06 11:02:14@
var
n,m,i,j,qm,bj,lw,max,cd,jxj:integer;
stu,b,c,d,gb,xb,xm,nm:string;
sum:longint;
procedure kg(var k:integer);
begin
k:=pos(' ',stu);
end;
procedure del(i:integer);
begin
delete(stu,1,i);
end;begin
readln(n);
if(n>100) or (n80)and(lw>0) then jxj:=jxj+8000;
if(qm>85)and(bj>80) then jxj:=jxj+4000;
if(qm>90) then jxj:=jxj+2000;
if(qm>85) and (xb='Y') then jxj:=jxj+1000;
if(bj>80) and (gb='Y') then jxj:=jxj+850;if jxj>max then
begin
max:=jxj;
xm:=nm;
end;
sum:=sum+jxj;
jxj:=0;
end;writeln(xm);
writeln(max);
writeln(sum);end.
-
02009-01-01 21:44:05@
struct student
{
char name;
int qj;
int bj;
int lw;
char bg;
char zb;
}student[100];
main()
{
struct student student[100];
int i,d,max,sum1,sum2;
char n;
max=0;
sum1=0;
sum2=0;
scanf("%d",&d);
for(i=1;i80)&&(student[i].qj>85))
sum1=sum1+4000;
if(student[i].qj>90)
sum1=sum1+2000;
if((student[i].zb=='Y')&&(student[i].qj>85))
sum1=sum1+1000;
if((student[i].bj=='Y')&&(student[i].bj>80))
sum1=sum1+850;
sum2=sum2+sum1;
if(max -
02008-12-21 13:40:18@
var i,j,k,n,m,p,ts,b:integer; tm:string[20]; ch:char; a:array[1..100]of integer;
s:array[1..101,1..9]of integer; name:array[1..100]of string[20];
begin
assign(input,'result.in');reset(input);
assign(output,'result.out');rewrite(output);
readln(n,m);
for i:=1 to n do
begin
name[i]:='';
read(ch);
while ch' ' do
begin
name[i]:=name[i]+ch;
read(ch);
end;
for j:=1 to m do read(s); readln;
end;
close(input);{ writeln(n,' ',m);
for i:=1 to n do
begin
write(name[i]); for j:=1 to m do write(' ',s); writeln;
end;
writeln;}for i:=1 to n do
begin
s:=0;
for j:=1 to m do s:=s+s;
end;for i:=1 to n-1 do
for j:=i+1 to n do
if s -
02008-12-18 16:59:19@
var i,j,k,n,m,p,ts,b:integer; tm:string[20]; ch:char; a:array[1..100]of integer;
s:array[1..101,1..9]of integer; name:array[1..100]of string[20];
begin
assign(input,'result.in');reset(input);
assign(output,'result.out');rewrite(output);
readln(n,m);
for i:=1 to n do
begin
name[i]:='';
read(ch);
while ch' ' do
begin
name[i]:=name[i]+ch;
read(ch);
end;
for j:=1 to m do read(s); readln;
end;
close(input);{ writeln(n,' ',m);
for i:=1 to n do
begin
write(name[i]); for j:=1 to m do write(' ',s); writeln;
end;
writeln;}for i:=1 to n do
begin
s:=0;
for j:=1 to m do s:=s+s;
end;for i:=1 to n-1 do
for j:=i+1 to n do
if s -
02008-12-16 22:07:31@
readln(n);
for i:=1 to n do
begin
read(ch);
while
read(ch);
end;
readln(a1[i],a2[i],ch,a3[i],ch,a4[i],ch,a5[i]);
end;
for i:=1 to n do
begin
p:=0;
if (a1[i]>80)and(a5[i]>=1) then inc(p,8000);
if (a1[i]>85)and(a2[i]>80) then inc(p,4000);
if (a1[i]>90) then inc(p,2000);
if (a1[i]>85)and(a4[i]='Y') then inc(p,1000);
if (a2[i]>80)and(a3[i]='Y') then inc(p,850);
if p>max then
begin
max:=p;
maxname:=name[i];
end;
inc(total,p);
end;
writeln(maxname);
writeln(max);
writeln(total);
end. -
02008-12-13 17:35: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-12-13 15:19:39@
var
n,i:integer;
name:array[1..100]of string;
a1,a2,a5:array[1..100]of integer;
a3,a4:array[1..100]of char;
max,p,total:longint;
maxname:string;
ch:char;
begin
readln(n);
for i:=1 to n do
begin
read(ch);
while ch' ' do
begin
name[i]:=name[i]+ch;
read(ch);
end;
readln(a1[i],a2[i],ch,a3[i],ch,a4[i],ch,a5[i]);
end;
for i:=1 to n do
begin
p:=0;
if (a1[i]>80)and(a5[i]>=1) then inc(p,8000);
if (a1[i]>85)and(a2[i]>80) then inc(p,4000);
if (a1[i]>90) then inc(p,2000);
if (a1[i]>85)and(a4[i]='Y') then inc(p,1000);
if (a2[i]>80)and(a3[i]='Y') then inc(p,850);
if p>max then
begin
max:=p;
maxname:=name[i];
end;
inc(total,p);
end;
writeln(maxname);
writeln(max);
writeln(total);
end. -
02008-12-13 13:35:37@
此程序显示编译错误,请问怎么修改?
#include
#include
#include
int main()
{
struct student
{char name[20];
int score1;
int score2;
char xuegan;
char xibu;
int lunwen;
}student[100];
int num,i,zong,zui=0,money[100]={0};
char bin[20];
FILE *fin=fopen("P1001.in","r");
FILE *fout=fopen("P1001.out","w");
fscanf(fin,"%d",&num);
for(i=0;i=num;i++)
fscanf(fin,"%s %d %d %c %c %d ",&student[i].name,&student[i].score1,&student[i].score2,&student[i].xuegan,&student[i].xibu,&student[i].lunwen);
for(i=0;i=num;i++)
{if((student[i].score1>80)&&(student[i].lunwen!=0))
money[i]+=8000;
else if((student[i].score1>85)&&(student[i].score2>80))
money[i]+=4000;
else if(student[i].score1>90)
money[i]+=2000;
else if((student[i].score1>85)&&(student[i].xibu='Y'))
money[i]+=1000;
else if((student[i].score2>80)&&(student[i].xuegan='Y'))
money[i]+=850;
}
for(i=0;i=num;i++)
{zong+=money[i];
if(money[i] -
02008-12-10 12:44:17@
program jiang;
type
node=record
na:string;
mo,yi,lun:integer;
gan,xi:char;
end;
var
a:array[1..200] of node;
sum:array[1..200] of integer;
s:string; all:longint;
n:integer;
procedure init;
var
i,k:integer; p:char;
begin
fillchar(sum,sizeof(sum),0);
readln(n);
for i:=1 to n do
begin
readln(s);
k:=pos(' ',s);
with a[i] do
begin
na:=copy(s,1,k-1);
delete(s,1,k);
k:=pos(' ',s);
val(copy(s,1,k-1),mo);
delete(s,1,k);
k:=pos(' ',s);
val(copy(s,1,k-1),yi);
delete(s,1,k);
gan:=s[1];
delete(s,1,2);
xi:=s[1];
delete(s,1,1);
val(s,lun);
end;
end;
{for i:=1 to n do
with a[i] do
begin
write(na,' ',mo,' ',yi,' ',gan,' ',xi,' ',lun);
writeln;
end;}
end;
procedure main;
var
i:integer; q:longint;
begin
all:=0;
for i:=1 to n do
with a[i] do
begin
q:=0;
if (mo>80) and (lun>=1) then inc(q,8000);
if (mo>85) and (yi>80) then inc(q,4000);
if (mo>90) then inc(q,2000);
if (xi='Y') and (mo>85) then inc(q,1000);
if (yi>80) and (gan='Y') then inc(q,850);
sum[i]:=q; inc(all,q);
end;
end;
procedure print;
var
i,max,bb:integer;
begin
max:=0;
for i:=1 to n do if sum[i]>max then max:=sum[i];
for i:=1 to n do
if sum[i]=max then begin bb:=i; break; end;
with a[bb] do
begin
writeln(na);
writeln(max);
end;
writeln(all);
end;
begin
init;
main;
print;
end.