讨论 / 求大神查错,emmmmmm……
wangxiaoyang 2018-04-26 20:07:29
点我顶贴 收藏 删除
var

a:array[1..100] of string;

b:array[1..100] of longint;

n,qimo,pingyi,lunwen,i,j,k,ans,temp:longint;

ganbu,xibu,temp2:string;

begin

readln(n);

for i:=1 to n do

begin

readln(a[i]);k:=pos(a[i],' ');val(copy(a[i],k+1,2),qimo);delete(a[i],k,3);

k:=pos(a[i],' ');val(copy(a[i],k+1,2),pingyi);delete(a[i],k,3);

k:=pos(a[i],' ');ganbu:=copy(a[i],k+1,2);delete(a[i],k,2);

k:=pos(a[i],' ');xibu:=copy(a[i],k+1,2);delete(a[i],k,2);

k:=pos(a[i],' ');val(copy(a[i],k+1,2),lunwen);delete(a[i],k,3);

if (qimo>80) and (lunwen>=1) then begin b[i]:=b[i]+8000;ans:=ans+8000;end;

if (qimo>85) and (pingyi>80) then begin b[i]:=b[i]+4000;ans:=ans+4000;end;

if qimo>90 then begin b[i]:=b[i]+2000;ans:=2000;end;

if (qimo>85) and (xibu='Y') then begin b[i]:=b[i]+1000;ans:=ans+1000;end;

if (pingyi>80) and (ganbu='Y') then begin b[i]:=b[i]+850;ans:=ans+850;end;

end;

for i:=1 to n-1 do

for j:=i+1 to n do

if b[i]<b[j] then begin temp:=b[i];b[i]:=b[j];b[j]:=temp;temp2:=a[i];a[i]:=a[j];a[j]:=temp2;end;

writeln(a[1]);

writeln(b[1]);

writeln(ans);

end.

程序在此。。。

#1 wangxiaoyang@2018-08-10 16:27:00
回复 删除
用一种全新的方式做了,啦啦啦~

#include<bits/stdc++.h>

using namespace std;

int n,money[103],qm[103],py[103],lw[103],zmoney,i,maxone;

string xm[103];

char gb[103],xb[103];

int main()

{

scanf("%d",&n);

for(i=1;i<=n;i++)

cin>>xm[i]>>qm[i]>>py[i]>>gb[i]>>xb[i]>>lw[i];

for(i=1;i<=n;i++)

{

if(qm[i]>80 && lw[i]>=1) money[i]=money[i]+8000;

if(qm[i]>85 && py[i]>80) money[i]=money[i]+4000;

if(qm[i]>90) money[i]=money[i]+2000;

if(qm[i]>85 && xb[i]=='Y') money[i]=money[i]+1000;

if(py[i]>80 && gb[i]=='Y') money[i]=money[i]+850;

}

maxone=1;zmoney=money[1];

for(i=2;i<=n;i++)

{

if(money[maxone]<money[i]) maxone=i;

zmoney=zmoney+money[i];

}

cout<<xm[maxone]<<endl;

printf("%d\n",money[maxone]);

printf("%d",zmoney);

return 0;

}

c++代码来啦~

查看更多回复
提交回复