508 条题解
-
0liuyuanzhe05 LV 9 @ 2015-04-02 16:03:32
const maxn=100;
type node=record
name:string;
score1,score2,cnt,money:longint;
flag1,flag2:boolean;
end;
var i,j,k,m,n,tot,ans,kk,max:longint;
inf:array[1..maxn] of node;
s,ts:string;
begin
assign(input,'1001.in');reset(input);
//assign(output,'.out');rewrite(output);readln(n);
for i:=1 to n do begin
readln(s);
s:=s+' ';
ts:='';tot:=0;
for j:=1 to length(s) do begin
if s[j]=' ' then begin
inc(tot);
case tot of
1:inf[i].name:=ts;
2:val(ts,inf[i].score1);
3:val(ts,inf[i].score2);
4:if ts='Y' then
inf[i].flag1:=true;
5:if ts='Y' then
inf[i].flag2:=true;
6:val(ts,inf[i].cnt);
end;
ts:='';
continue;
end;
ts:=ts+s[j];
end;
end;max:=0;ans:=0;
for i:=1 to n do begin
if (inf[i].score1>80) and (inf[i].cnt>0) then
inc(inf[i].money,8000);
if (inf[i].score1>85) and (inf[i].score2>80) then
inc(inf[i].money,4000);
if (inf[i].score1>90) then
inc(inf[i].money,2000);
if (inf[i].score1>85) and (inf[i].flag2) then
inc(inf[i].money,1000);
if (inf[i].score2>80) and (inf[i].flag1) then
inc(inf[i].money,850);
inc(ans,inf[i].money);
if inf[i].money>max then begin
max:=inf[i].money;
kk:=i;
end;
end;
writeln(inf[kk].name);
writeln(max);
writeln(ans);
end. -
02015-03-29 16:56:14@
处女贴,嗯这只是个测试(
```C++
#include <iostream>
using namespace std;
#define is(x) (x-'N')int main(void){
int count;
cin >> count;
string names[count];
unsigned cash, exam, eone, paper, maxcash=0, who;
long total;
char work, west;
for (int i=0; i<count; i++) {
cash = 0;
cin >> names[i] >> exam >> eone >> work >> west >> paper;if (exam>80 && paper) cash+=8000;
if (exam>85 && eone>80) cash+=4000;
if (exam>90) cash+=2000;
if (exam>85 && is(west)) cash+=1000;
if (eone>80 && is(work)) cash+=850;if (cash>maxcash) {
who = i;
maxcash=cash;
}
total+=cash;
}
cout << names[who] << endl << maxcash << endl << total;
return 0;
}
``` -
02015-03-18 11:03:26@
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
struct student
{
string name;
int score,classscore,passage,money;
char cadre,weststudent;
}S[105];
bool compare(student a,student b){return a.money<b.money;}
int main()
{
int n,ans=0;
scanf("%d",&n);
for(int i=0;i<n;i++) cin>>S[i].name>>S[i].score>>S[i].classscore>>S[i].cadre>>S[i].weststudent>>S[i].passage;
for(int i=0;i<n;i++)
{
S[i].money=0;
if(S[i].score>80&&S[i].passage>0) S[i].money+=8000;
if(S[i].score>85&&S[i].classscore>80) S[i].money+=4000;
if(S[i].score>90) S[i].money+=2000;
if(S[i].score>85&&S[i].weststudent=='Y') S[i].money+=1000;
if(S[i].classscore>80&&S[i].cadre=='Y') S[i].money+=850;
ans+=S[i].money;
}
student t=*max_element(S,S+n,compare);
cout<<t.name<<endl<<t.money<<endl<<ans;
return 0;
} -
02015-02-16 21:19:21@
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=105;
int numn,sum=0;
struct student
{
char n[23];
int num;
int qm;
int py;
bool gb;
bool xb;
int lw;
int jj;
student(){memset(n,0,sizeof(n));jj=0;gb=false;xb=false;}
};student k[maxn];
void judge(int cur)
{
if(k[cur].qm>80&&k[cur].lw>0)k[cur].jj+=8000;
if(k[cur].qm>85&&k[cur].py>80)k[cur].jj+=4000;
if(k[cur].qm>90)k[cur].jj+=2000;
if(k[cur].qm>85&&k[cur].xb)k[cur].jj+=1000;
if(k[cur].py>80&&k[cur].gb)k[cur].jj+=850;
sum+=k[cur].jj;
}
bool cmp(student a,student b)
{
if(a.jj>b.jj)return true;
else if(a.jj==b.jj)return a.num<b.num;
else return false;
}
int main()
{
scanf("%d",&numn);
for(int i=1;i<=numn;i++)
{
scanf("\n");
k[i].num=i;
scanf("%s%d%d",k[i].n,&k[i].qm,&k[i].py);
char a,b;
scanf(" %c %c%d",&a,&b,&k[i].lw);
if(a=='Y')k[i].gb=true;if(b=='Y')k[i].xb=true;
judge(i);
}
sort(k+1,k+1+numn,cmp);
if(k[1].jj)
printf("%s\n%d\n%d\n",k[1].n,k[1].jj,sum);
return 0;
} -
02015-02-09 23:14:58@
var n,i,j,k,l,max:longint;
b,c,f,g:array [1..100] of integer;
a,d,e:array [1..100] of string;
s,t,st:string;
begin
readln(n);
for i:=1 to n do
begin
readln(s);
l:=pos(' ',s);
a[i]:=copy(s,1,l-1);
delete(s,1,l);
l:=pos(' ',s);
t:=copy(s,1,l-1);
val(t,b[i]);
delete(s,1,l);
l:=pos(' ',s);
t:=copy(s,1,l-1);
val(t,c[i]);
delete(s,1,l);
l:=pos(' ',s);
d[i]:=copy(s,1,l-1);
delete(s1l);
l:=pos(' ',s);
e[i]:=copy(s,1,l-1);
delete(s,1,l);
val(s,f[i]);
end;
end;fillchar(gsizeof(g),0);
for i:=1 to n do
begin
if (b[i]>80) and (f[i]>=1) then inc(g[i],8000);
if (b[i]>85) and (c[i]>80) then inc(g[i],4000);
if (b[i]>90) then inc(g[i],2000);
if (b[i]>85) and (e[i]='Y') then inc(g[i],1000);
if (c[i]>80) and (d[i]='Y') then inc(g[i]850);
end;
max:=0;
l:=0;
for i:=1 to n do
begin
l:=l+g[i];
if g[i]>max then
begin
max:=g[i];
st:=a[i];
end;
end;
writeln(st);
writeln(max);
writeln(l);
end. -
02015-02-01 09:16:32@
var
max,n,sum1,sum,qm,py,i,p,lw:longint;
f1,f2:boolean;
xm,xm1,st:string;
begin
readln(n); max:=0;
for i:=1 to n do
begin
readln(st); f1:=false;f2:=false;st:=st+' ';sum1:=0;
p:=pos(' ',st);
xm:=copy(st,1,p-1);delete(st,1,p);p:=pos(' ',st);
val(copy(st,1,p-1),qm);delete(st,1,p);p:=pos(' ',st);
val(copy(st,1,p-1),py);delete(st,1,p);p :=pos(' ',st);
if copy(st,1,1)='Y' then f1:=true;delete(st,1,p);p:=pos(' ',st);
if copy(st,1,1)='Y' then f2:=true;delete(st,1,p);p:=pos(' ',st);
val(copy(st,1,p-1),lw);
if (qm>80) and (lw>=1) then sum1:=sum1+8000;
if (qm>85) and (py>80) then sum1:=sum1+4000;
if qm>90 then sum1:=sum1+2000;
if (qm>85) and (f2=true) then sum1:=sum1+1000;
if (py>80) and (f1=true) then sum1:=sum1+850;
if sum1>max then begin max:=sum1;xm1:=xm;end;sum:=sum+sum1;
end;
writeln(xm1);writeln(max);writeln(sum);
end. -
02015-02-01 08:57:37@
var n,i,a,b,c,ans,j,k:longint;
s:array[0..100] of string;
sum,k2:array[0..100] of longint;
b1,b2:char;
s1,s2:string;
begin
readln(n);
for i:=1 to n do
begin
readln(s1); s1:=s1+' ';
s[i]:='';k:=1;while s1[k]<>' ' do
begin
s[i]:=s[i]+s1[k];
inc(k);
end;
inc(k);s2:='';while s1[k]<>' ' do
begin
s2:=s2+s1[k];
inc(k);
end;val(s2,a);s2:='';inc(k);
while s1[k]<>' ' do
begin
s2:=s2+s1[k];
inc(k);
end;val(s2,b);s2:='';
b1:=s1[k+1]; b2:=s1[k+3]; inc(k,5);while s1[k]<>' ' do
begin
s2:=s2+s1[k];
inc(k);
end;
val(s2,c);sum[i]:=0; k2[i]:=i;
if (a>80) and (c>=1) then inc(sum[i],8000);
if (a>85) and (b>80) then inc(sum[i],4000);
if (a>90) then inc(sum[i],2000);
if (a>85) and (b2='Y') then inc(sum[i],1000);
if (b>80) and (b1='Y') then inc(sum[i],850);
inc(ans,sum[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if (sum[i]<sum[j]) or ((sum[i]=sum[j]) and (k2[i]>k2[j])) then
begin
sum[0]:=sum[i]; sum[i]:=sum[j]; sum[j]:=sum[0];
k2[0]:=k2[i]; k2[i]:=k2[j]; k2[j]:=k2[0];
s[0]:=s[i]; s[i]:=s[j]; s[j]:=s[0];
end;
writeln(s[1]);
writeln(sum[1]);
writeln(ans);
end. -
02015-01-09 20:04:27@
type aa=record
name:string;
qi,ban,lun:integer;
xu,xi:char;
fan:longint;end;
var
a:array[0..100]of aa;
zong,l,r,m,n,x:int64;
i,j:longint;
s:string;BEGIN
readln(n);zong:=0;
for i:=1 to n do
begin
readln(s);
a[i].name:=copy(s,1,pos(' ',s)-1);
delete(s,1,pos(' ',s));
val(copy(s,1,pos(' ',s)-1),a[i].qi);
delete(s,1,pos(' ',s));
val(copy(s,1,pos(' ',s)-1),a[i].ban);
delete(s,1,pos(' ',s));
a[i].xu:=s[1];
a[i].xi:=s[3];
a[i].lun:=ord(s[5])-48;
end; m:=0;
for i:=1 to n do
begin
if (a[i].qi>80) and (a[i].lun>=1) then inc(a[i].fan,8000);
if (a[i].qi>85) and (a[i].ban>80) then inc(a[i].fan,4000);
if a[i].qi>90 then inc(a[i].fan,2000);
if (a[i].xi='Y') and (a[i].qi>85) then inc(a[i].fan,1000);
if (a[i].ban>80) and (a[i].xu='Y') then inc(a[i].fan,850);
m:=m+a[i].fan;
if a[i].fan>a[zong].fan then zong:=i;
end;
writeln(a[zong].name);
writeln(a[zong].fan);
writeln(m);END.
-
02014-12-27 19:58:09@
(:з」∠)这么多题都没见过几个Java的题解 还是发一发吧
Block Code
import java.util.Scanner;
public class Main {
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int length = Integer.valueOf(scanner.nextLine());
Object[] xingming = new Object[length], qimo = new Object[length],
banji = new Object[length], ganbu = new Object[length],
xibu = new Object[length], lunwen = new Object[length];
int[] point = new int[length];
for(int i = 0; i < length; i++) {
String[] info = scanner.nextLine().split(" ");
xingming[i] = String.valueOf(info[0]);
qimo[i] = Integer.valueOf(info[1]);
banji[i] = Integer.valueOf(info[2]);
ganbu[i] = info[3].equals("Y") ? true : false;
xibu[i] = info[4].equals("Y") ? true : false;
lunwen[i] = Integer.valueOf(info[5]);
}
for(int i = 0; i < length; i++) {
if((int)qimo[i] > 80 && (int)lunwen[i] >= 1)
point[i] += 8000;
if((int)qimo[i] > 85 && (int)banji[i] > 80)
point[i] += 4000;
if((int)qimo[i] > 90)
point[i] += 2000;
if((int)qimo[i] > 85 && (boolean)xibu[i])
point[i] += 1000;
if((int)banji[i] > 80 && (boolean)ganbu[i])
point[i] += 850;
}
int temp = 0;
int index = 0;
int count = 0;
for(int i = 0; i < length; i++) {
if(point[i] > temp) {
index = i;
temp = point[i];
}
count += point[i];
}
System.out.println(xingming[index]);
System.out.println(point[index]);
System.out.println(count);
}
} -
02014-12-27 14:50:29@
简单是简单,就是你要细心
c++ code
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;struct str{
int qm;
int bj;
bool gb;
bool xb;
int lw;
};struct tj{
string name;
int num;
};int pd(str s)
{
int ans=0;
if (s.qm>80&&s.lw>=1) ans+=8000;
if (s.qm>85&&s.bj>80) ans+=4000;
if (s.qm>90) ans+=2000;
if (s.xb==1&&s.qm>85) ans+=1000;
if (s.gb==1&&s.bj>80) ans+=850;
return ans;
}bool comp(tj a,tj b)
{
return a.num>b.num;
}
int main()
{
char ch;
vector<tj> a;
str t;
tj v;
int n,i,k=1,ans=0;
cin>>n;
for (i=0;i!=n;i++)
{
cin>>v.name>>t.qm>>t.bj;
cin>>ch;
t.gb=ch=='Y'?1:0;
cin>>ch;
t.xb=ch=='Y'?1:0;
cin>>t.lw;
v.num=pd(t);
a.push_back(v);
}
stable_sort(a.begin(),a.end(),comp);
cout<<a[0].name<<endl<<a[0].num<<endl;
for (i=0;i<n;i++)
{
ans+=a[i].num;
}
cout<<ans;
return 0;
} -
02014-12-27 08:54:48@
o,shit
不小心把班级贡献奖拿期末成绩去评了没注意,结果得了30分。害我浪费10分钟去找,总算轻松AC啦(AC不了就在VJ混不起了)
看来以后比赛的时候复制粘贴还是要谨慎啊~~希望到时候别死在这里。还好我机智给测出来了。
代码如下,纯读入输出而已。
###Block code
program P1001;
var n,i,k,s,max:longint;
sum:int64;
a:string;
add:char;
namee:array[1..100] of string;
num:array[1..100,1..4] of longint;
pd:array[1..100,1..2] of char;
procedure readname;
begin
for i:=1 to n do
begin
add:='a'; a:='';
read(add);
while add<>' ' do
begin
a:=a+add;
read(add);
end;
namee[i]:=a;
s:=length(a);read(num[i,1]);
read(num[i,2]);read(add);
read(add);
pd[i,1]:=add;
read(add); read(add);
pd[i,2]:=add;
read(num[i,3]);
end;
end;begin //main
read(n); a:=''; sum:=0; max:=1;
fillchar(num,sizeof(num),0);
readname;for i:=1 to n do
begin
if (num[i,1]>80) and (num[i,3]>=1) then
begin
num[i,4]:=num[i,4]+8000;
sum:=sum+8000;
end;if (num[i,1]>85) and (num[i,2]>80) then
begin
num[i,4]:=num[i,4]+4000;
sum:=sum+4000;
end;if (num[i,1]>90) then
begin
num[i,4]:=num[i,4]+2000;
sum:=sum+2000;
end;if (num[i,1]>85) and (pd[i,2]='Y') then
begin
num[i,4]:=num[i,4]+1000;
sum:=sum+1000;
end;if (num[i,2]>80) and (pd[i,1]='Y') then
begin
num[i,4]:=num[i,4]+850;
sum:=sum+850;
end;if num[i,4]>num[max,4] then
max:=i;
end;writeln(namee[max]);
writeln(num[max,4]);
write(sum);
end. -
02014-12-13 22:40:19@
用case做了
var s,s1,anss:string;
i,j,k,p,n,ans,qi,ba,ga,xi,lu,zui:longint;
procedure work;
var xy:longint;
begin
xy:=0;
if (lu>=1) and (qi>80) then xy:=xy+8000;
if (qi>85) and (ba>80) then xy:=xy+4000;
if (qi>90) then xy:=xy+2000;
if (qi>85) and (xi=1) then xy:=xy+1000;
if (ba>80) and (ga=1) then xy:=xy+850;
if xy>zui then begin
anss:=s1;
zui:=xy;
end;
ans:=ans+xy;
end;
begin
readln(n);
for i:=1 to n do begin
readln(s);
s:=s+' ';
qi:=0;ba:=0;ga:=0;xi:=0;lu:=0;
k:=0;
for j:=1 to length(s) do begin
if s[j]=' ' then begin
k:=k+1;
case k of
1:begin
s1:=copy(s,1,j-1);
p:=j;
end;
2:begin
val(copy(s,p+1,j-p-1),qi);
p:=j;
end;
3:begin
val(copy(s,p+1,j-p-1),ba);
p:=j
end;
4:if s[j-1]='Y' then ga:=1;
5:begin
if s[j-1]='Y' then xi:=1;
p:=j;
end;
6:val(copy(s,p+1,j-p-1),lu);
end;
end;end;
work;
end;
writeln(anss);
writeln(zui);
writeln(ans);
end. -
02014-12-05 14:29:47@
题解:总算过了。
#include <iostream>
#include <string>
using namespace std;
struct Stu{
char name[20];
int score1;
int score2;
char leader;
char westStudent;
int article;
int sum=0;
};
int main(){int max=0;
int rmb=0;
int n;
Stu a[100];
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i].name;
cin>>a[i].score1;
cin>>a[i].score2;
cin>>a[i].leader;
cin>>a[i].westStudent;
cin>>a[i].article;
}
for(int j=0;j<n;j++){
if(a[j].score1>80&&a[j].article>=1) a[j].sum+=8000;
if(a[j].score1>85&&a[j].score2>80) a[j].sum+=4000;
if(a[j].score1>90) a[j].sum+=2000;
if(a[j].score1>85&&a[j].westStudent=='Y') a[j].sum+=1000;
if(a[j].score2>80&&a[j].leader=='Y') a[j].sum+=850;
rmb+=a[j].sum;
}
for(int p=0;p<n;p++){
if(a[p].sum>a[max].sum)
max=p;
}
cout<<a[max].name<<endl;
cout<<a[max].sum<<endl;
cout<<rmb<<endl;
return 0;
} -
02014-11-30 16:20:35@
type
Tmingzi=array[1..21] of char;
student=record
mingzi:Tmingzi;
lenmingzi:longint;
qmcj:longint;
bjcj:longint;
gb:boolean;
xb:boolean;
lw:longint;
jxj:longint;
end;
var
temp1,temp2,h1,h2,h3:char;
a:array[1..100] of student;
i,n,j,max,sum:longint;
procedure getjxj(var s:student);
begin
if (s.qmcj>80) and (s.lw>=1) then s.jxj:=s.jxj+8000;
if (s.qmcj>85) and (s.bjcj>80) then s.jxj:=s.jxj+4000;
if s.qmcj>90 then s.jxj:=s.jxj+2000;
if (s.qmcj>85) and (s.xb) then s.jxj:=s.jxj+1000;
if (s.bjcj>80) and (s.gb) then s.jxj:=s.jxj+850;
end;
begin
readln(n);
for i:=1 to n do
begin
for j:=1 to 21 do
begin
read(a[i].mingzi[j]);
if a[i].mingzi[j]=' ' then
begin
a[i].lenmingzi:=j-1;
break;
end;
end;
readln(a[i].qmcj,a[i].bjcj,h1,temp1,h2,temp2,h3,a[i].lw);
case temp1 of
'Y':a[i].gb:=true;
'N':a[i].gb:=false;
end;
case temp2 of
'Y':a[i].xb:=true;
'N':a[i].xb:=false;
end;
end;
for i:=1 to n do
getjxj(a[i]);
max:=1;
for i:=n downto 1 do
if a[i].jxj>=a[max].jxj then max:=i;
sum:=0;
for i:=1 to n do
sum:=sum+a[i].jxj;
for i:=1 to a[max].lenmingzi do
write(a[max].mingzi[i]);
writeln;
writeln(a[max].jxj);
writeln(sum);
end. -
02014-11-07 22:37:53@
可能比较笨。。。但是AC了
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef struct book{
int num;
char name[20];
int endaver;
int classaver;
char emp;
char west;
int pass;
int sum;};
book que[101];
int is_west(int a){
return (que[a].west=='Y') ? 1:0;}
int is_pass(int a){
return (que[a].pass>0)?1:0;}
int is_emp(int a){
return (que[a].emp=='Y')? 1:0;}
int prize(int a){
if(que[a].classaver>80&&is_emp(a))
que[a].sum+=850;
if(que[a].endaver>90)
que[a].sum+=2000;
if(que[a].endaver>80&&is_pass(a))
que[a].sum+=8000;
if(que[a].endaver>85&&que[a].classaver>80)
que[a].sum+=4000;
if(que[a].endaver>85&&is_west(a))
que[a].sum+=1000;}
int main(){
int n,summ=0;
cin >>n;
int max=0,maxi=0;
for(int i=0;i<n;i++){
scanf("%s %d %d %c %c %d",que[i].name,&que[i].endaver,&que[i].classaver,&que[i].emp,&que[i].west,&que[i].pass) ;
que[i].num=i;
prize(i);
if(que[i].sum>max)
{
max=que[i].sum;
maxi=i;
}}
for(int aaa=0;aaa<n;aaa++){
summ+=que[aaa].sum;
}
printf("%s\n",que[maxi].name);
printf("%d\n",max);
printf("%d",summ);
} -
02014-11-07 22:37:42@
可能比较笨。。。但是AC了
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef struct book{
int num;
char name[20];
int endaver;
int classaver;
char emp;
char west;
int pass;
int sum;};
book que[101];
int is_west(int a){
return (que[a].west=='Y') ? 1:0;}
int is_pass(int a){
return (que[a].pass>0)?1:0;}
int is_emp(int a){
return (que[a].emp=='Y')? 1:0;}
int prize(int a){
if(que[a].classaver>80&&is_emp(a))
que[a].sum+=850;
if(que[a].endaver>90)
que[a].sum+=2000;
if(que[a].endaver>80&&is_pass(a))
que[a].sum+=8000;
if(que[a].endaver>85&&que[a].classaver>80)
que[a].sum+=4000;
if(que[a].endaver>85&&is_west(a))
que[a].sum+=1000;}
int main(){
int n,summ=0;
cin >>n;
int max=0,maxi=0;
for(int i=0;i<n;i++){
scanf("%s %d %d %c %c %d",que[i].name,&que[i].endaver,&que[i].classaver,&que[i].emp,&que[i].west,&que[i].pass) ;
que[i].num=i;
prize(i);
if(que[i].sum>max)
{
max=que[i].sum;
maxi=i;
}}
for(int aaa=0;aaa<n;aaa++){
summ+=que[aaa].sum;
}
printf("%s\n",que[maxi].name);
printf("%d\n",max);
printf("%d",summ);
} -
02014-11-03 15:56:07@
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
int n,a,b,c,k,ans[105],sum,max;
char name[105][40],ju1,ju2,s[40];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%s%d%d %c %c %d",name[i],&a,&b,&ju1,&ju2,&c);
if(a>80&&c>=1) ans[i]+=8000;
if(a>85&&b>80) ans[i]+=4000;
if(a>90) ans[i]+=2000;
if(a>85&&ju2=='Y') ans[i]+=1000;
if(b>80&&ju1=='Y') ans[i]+=850;
sum+=ans[i];
if(ans[i]>max)
{
max=ans[i];
k=i;
}
}
printf("%s",name[k]);
printf("\n%d\n%d\n",ans[k],sum);
return 0;
} -
02014-10-25 11:15:43@
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cctype>
using namespace std;
int N,alm=0,aln=0;
struct student
{
int num;
string name;
int rmb;
}stu[101];
const bool stusort(const student &a,const student &b)
{
if(a.rmb!=b.rmb) return a.rmb>b.rmb;
return a.num<b.num;
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
scanf("%d\n",&N);
for(int i=1;i<=N;i++)
{
alm=0;
int fnl=0,cnl=0,lw=0;
char tmp1,tmp2;
cin>>stu[i].name;
scanf(" %d%d",&fnl,&cnl);
scanf(" %c",&tmp1);
scanf(" %c",&tmp2);
scanf(" %d",&lw);
if(fnl>80 && lw>=1)
alm+=8000;
if(fnl>85 && cnl>80)
alm+=4000;
if(fnl>90)
alm+=2000;
if(fnl>85 && tmp2=='Y')
alm+=1000;
if(cnl>80 && tmp1=='Y')
alm+=850;
aln+=alm;
stu[i].rmb=alm;
stu[i].num=i;
}
sort(stu+1,stu+N+1,stusort);
cout<<stu[1].name<<endl;
printf("%d\n%d\n",stu[1].rmb,aln);
return 0;
}
此题弱爆,鉴定完毕 -
02014-09-30 22:48:54@
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
long long money[102],n,i,j,mark[102],cmark[102],art[102],sum,max;
int turn[102];
string name[102],xue[102],xi[102],str;
cin>>n;
for (i=1;i<=n;i++)
{
cin>>name[i];
cin>>mark[i];
cin>>cmark[i];
cin>>xue[i];
cin>>xi[i];
cin>>art[i];
turn[i]=i;
} //输入
for (i=1;i<=n;i++) money[i]=0; //清零for (i=1;i<=n;i++)
{
if (mark[i]>80 && art[i]>=1) money[i]=money[i]+8000;
if (mark[i]>85 && cmark[i]>80) money[i]=money[i]+4000;
if (mark[i]>90) money[i]=money[i]+2000;
if (mark[i]>85 && xi[i]=="Y") money[i]=money[i]+1000;
if (xue[i]=="Y" && cmark[i]>80) money[i]=money[i]+850;
} //计算每个人的奖学金
sum=0;
for (i=1;i<=n;i++) sum=sum+money[i];max=0;
for (i=1;i<=n;i++)
{
if (max<money[i])
{
max=money[i];
str=name[i];
}
}
cout<<str<<endl;
cout<<max<<endl;
cout<<sum<<endl;
system("pause");
return 0;
} -
02014-09-28 20:43:42@
请帮我看一下哪里错了(第二组数据在运算时错误),
var i,q,n,k:longint;
m,p,l,o:int64;
a,s:string;
lw,jj:array[1..100]of int64;
mz:array[1..100]of string;
g:array[1..100,1..2]of string;
j:array[1..100,1..2]of int64;
begin
readln(n);
for i:=1 to n do
begin
readln(a);
for q:=1 to 6 do
begin
if q<>6 then begin k:=pos(' ',a);
s:=copy(a,1,k-1) end else begin k:=1; s:=copy(a,1,k); val(s,lw[i]); end;
val(s,j[i,q-1]);
g[i,q-3]:=s;
if q=1 then mz[i]:=copy(a,1,k-1);
delete(a,1,k);
end;
if (j[i,1]>80)and(lw[i]>=1) then jj[i]:=jj[i]+8000;
if (j[i,1]>85)and(j[i,2]>80) then jj[i]:=jj[i]+4000;
if j[i,1]>90 then jj[i]:=jj[i]+2000;
if (j[i,1]>85)and(g[i,2]='Y') then jj[i]:=jj[i]+1000;
if (j[i,2]>80)and(g[i,1]='Y') then jj[i]:=jj[i]+850;
if o<jj[i] then begin p:=i; o:=jj[i]; end;
m:=m+jj[i];
end;
writeln(mz[p]);
writeln(o);
writeln(m);
end.