508 条题解
-
0panfeite LV 7 @ 2017-04-21 23:41:35
#include<iostream>
using namespace std;
int main()
{
string a,g;
int b,c,f,n,money=0,result=0,sum=0;
char d,e;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a>>b>>c>>d>>e>>f;
money=0;
if(b>80&&f>=1)
money+=8000;
if(b>85&&c>80)
money+=4000;
if(b>90)
money+=2000;
if(b>85&&e=='Y')
money+=1000;
if(c>80&&d=='Y')
money+=850;
sum+=money;
if(result<money)
{
result=money;
g=a;
}
}
cout<<g<<endl<<result<<endl<<sum<<endl;
return 0;
} -
02017-04-21 23:41:02@
#include<iostream>
using namespace std;
int main()
{
string a,g;
int b,c,f,n,money=0,result=0,sum=0;
char d,e;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a>>b>>c>>d>>e>>f;
money=0;
if(b>80&&f>=1)
money+=8000;
if(b>85&&c>80)
money+=4000;
if(b>90)
money+=2000;
if(b>85&&e=='Y')
money+=1000;
if(c>80&&d=='Y')
money+=850;
sum+=money;
if(result<money)
{
result=money;
g=a;
}
}
cout<<g<<endl<<result<<endl<<sum<<endl;
return 0;
} -
02017-04-14 15:55:42@
#include<iostream> #include<vector> #include<string> using namespace std; class Student{ public: Student(); friend ostream &operator<<(ostream &os,const Student &m); void BonusCaculate(); void Input(); string name; int final_grade; int class_grade; char student_carde; char western_stu; short int papers; int bonus; }; Student::Student(){ bonus = 0; } void Student::Input(){ cin>>name>>final_grade>>class_grade>>student_carde>>western_stu>>papers; } ostream &operator<<(ostream &os,const Student &m){ os<<m.name<<endl<<m.bonus<<endl; return os; } void Student::BonusCaculate(){ if(final_grade>80&&papers>=1) bonus += 8000; if(final_grade>85&&class_grade>80) bonus += 4000; if(final_grade>90) bonus += 2000; if(western_stu == 'Y'&&final_grade>85) bonus += 1000; if(student_carde == 'Y'&&class_grade>80) bonus += 850; } int main(){ int n,p = 0,total_bonus = 0; cin>>n; vector<Student> students(n); for(int i = 0; i < n; i++){ students[i].Input(); students[i].BonusCaculate(); total_bonus += students[i].bonus; } for(int i = 0; i < n-1;i++){ if(students[p].bonus < students[i+1].bonus) p = i+1; } cout<<students[p]<<total_bonus; return 0; }
-
02017-04-02 14:40:04@
//你们无法体会血之哀的孤独
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iomanip>
using namespace std;
int saber[101]= {0};
int lmf=0;
int nono=0;
int mx=0;
struct jxj
{
string name;
int cj;
int bp;
char gp;
char xb;
int lw;
} a[200];
int main()
{
int n;
cin>>n;
string lmf;
for(int i=1; i<=n; i++)
{
cin>>a[i].name >>a[i].cj>>a[i].bp >>a[i].gp>>a[i].xb >>a[i].lw ;
if(a[i].cj >80&&a[i].lw >0)
saber[i]+=8000;
if(a[i].cj>85&&a[i].bp >80)
saber[i]+=4000;
if(a[i].cj >90)
saber[i]+=2000;
if(a[i].cj >85&&a[i].xb =='Y')
saber[i]+=1000;
if(a[i].bp >80&&a[i].gp =='Y')
saber[i]+=850;
if(saber[i]>mx)
{
mx=saber[i];
lmf=a[i].name ;
}
}
for(int i=1;i<=n;i++)
{
nono+=saber[i];
}
cout<<lmf<<endl<<mx<<endl<<nono;
return 0;
} -
02017-03-31 18:38:42@
#include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
char s[n][20];
int final[n];
int class0[n];
char stu[n];
char west[n];
int paper[n];
long money[n];
for(i=0;i<=n-1;i++)
{
scanf("%s %d %d %c %c %d",s[i],&final[i],&class0[i],&stu[i],&west[i],&paper[i]);
money[i]=0;
if (final[i]>80&&paper[i]>0) money[i]=money[i]+8000;
if (final[i]>85&&class0[i]>80) money[i]=money[i]+4000;
if (final[i]>90) money[i]=money[i]+2000;
if (final[i]>85&&west[i]=='Y') money[i]=money[i]+1000;
if (final[i]>80&&stu[i]=='Y') money[i]=money[i]+850;
}
int max=0,mark,sum=0;
for(i=0;i<=n-1;i++)
{
if (money[i]>max)
{
max=money[i];
mark=i;
}
sum=sum+money[i];
}
printf("%s\n",s[mark]);
printf("%d\n",money[mark]);
printf("%d",sum);
return 0;
} -
02017-03-31 18:38:14@
#include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
char s[n][20];
int final[n];
int class0[n];
char stu[n];
char west[n];
int paper[n];
long money[n];
for(i=0;i<=n-1;i++)
{
scanf("%s %d %d %c %c %d",s[i],&final[i],&class0[i],&stu[i],&west[i],&paper[i]);
money[i]=0;
if (final[i]>80&&paper[i]>0) money[i]=money[i]+8000;
if (final[i]>85&&class0[i]>80) money[i]=money[i]+4000;
if (final[i]>90) money[i]=money[i]+2000;
if (final[i]>85&&west[i]=='Y') money[i]=money[i]+1000;
if (final[i]>80&&stu[i]=='Y') money[i]=money[i]+850;
}
int max=0,mark,sum=0;
for(i=0;i<=n-1;i++)
{
if (money[i]>max)
{
max=money[i];
mark=i;
}
sum=sum+money[i];
}
printf("%s\n",s[mark]);
printf("%d\n",money[mark]);
printf("%d",sum);
return 0;
} -
02017-03-20 21:37:59@
#include <iostream>
#include <algorithm>
using namespace std;struct list{
int num; //序号
string xm;//姓名
int pm; //期末平均成绩
int bj; //班级评议成绩
char xsgb;//学生干部
char xbsf;//西部省份
int lw; //论文
int sum; //奖金
};list k[101];
int main() {
int n,i,s=0,max=0;
string name;
cin>>n;
for(i=1;i<=n;i++){
k[i].num=i;
cin>>k[i].xm>>k[i].pm>>k[i].bj>>k[i].xsgb>>k[i].xbsf>>k[i].lw;
k[i].sum=0;
if(k[i].pm>80 && k[i].lw>0) //院士奖学金
k[i].sum+=8000;
if(k[i].pm>85 && k[i].bj>80) //五四奖学金
k[i].sum+=4000;
if(k[i].pm>90) //成绩优秀奖
k[i].sum+=2000;
if(k[i].pm>85 && k[i].xbsf=='Y')//西部奖学金
k[i].sum+=1000;
if(k[i].bj>80 && k[i].xsgb=='Y') //班级贡献奖
k[i].sum+=850;
s+=k[i].sum;
if(max<k[i].sum){
max=k[i].sum;
name=k[i].xm;
}
}
cout<<name<<endl<<max<<endl<<s;
return 0;
} -
02017-03-20 21:37:24@
#include <iostream>
#include <algorithm>
using namespace std;struct list{
int num; //序号
string xm;//姓名
int pm; //期末平均成绩
int bj; //班级评议成绩
char xsgb;//学生干部
char xbsf;//西部省份
int lw; //论文
int sum; //奖金
};list k[101];
int main() {
int n,i,s=0,max=0;
string name;
cin>>n;
for(i=1;i<=n;i++){
k[i].num=i;
cin>>k[i].xm>>k[i].pm>>k[i].bj>>k[i].xsgb>>k[i].xbsf>>k[i].lw;
k[i].sum=0;
if(k[i].pm>80 && k[i].lw>0) //院士奖学金
k[i].sum+=8000;
if(k[i].pm>85 && k[i].bj>80) //五四奖学金
k[i].sum+=4000;
if(k[i].pm>90) //成绩优秀奖
k[i].sum+=2000;
if(k[i].pm>85 && k[i].xbsf=='Y')//西部奖学金
k[i].sum+=1000;
if(k[i].bj>80 && k[i].xsgb=='Y') //班级贡献奖
k[i].sum+=850;
s+=k[i].sum;
if(max<k[i].sum){
max=k[i].sum;
name=k[i].xm;
}
}
cout<<name<<endl<<max<<endl<<s;
return 0;
} -
02017-03-15 19:54:51@
#include<iostream>
#include<functional>
#include<queue>
#include<cstring>
#include<string>
#include<algorithm>
#include <vector>
#include<math.h>using namespace std;
struct student
{
string name;
int score;
int cscore;
char leader;
char west;
int paper;
int money;
} v[101];int main()
{
int n,max=0,sum=0,k;
cin>>n;
for(int i=0;i<n;i++)cin>>v[i].name>>v[i].score>>v[i].cscore>>v[i].leader>>v[i].west>>v[i].paper;
for(int i=0;i<n;i++)
{
v[i].money=0;
if(v[i].score>80&&v[i].paper>0)
v[i].money+=8000;
if(v[i].score>85&&v[i].cscore>80)
v[i].money+=4000;
if(v[i].score>90)
v[i].money+=2000;
if(v[i].score>85&&v[i].west=='Y')
v[i].money+=1000;
if(v[i].cscore>80&&v[i].leader=='Y')
v[i].money+=850;
if(v[i].money>max)
{
max=v[i].money;
k=i;
}
sum+=v[i].money;
}
cout<<v[k].name<<endl<<v[k].money<<endl<<sum;
return(0);
} -
02017-03-12 19:59:27@
#include<iostream> #include<string> using namespace std; struct stu { string name; int qimo; int banping; char ganbu; char cibu; int wen; int money; }; int main() { int n,i; cin>>n; stu b[101]; for(i=0;i<n;i++) { cin>>b[i].name>>b[i].qimo>>b[i].banping>>b[i].ganbu>>b[i].cibu>>b[i].wen;b[i].money=0; if(b[i].qimo>80 && b[i].wen>=1)b[i].money+=8000; if(b[i].qimo> 85 && b[i].banping > 80)b[i].money+=4000; if(b[i].qimo>90)b[i].money+=2000; if(b[i].qimo>85 && b[i].cibu=='Y')b[i].money+=1000; if(b[i].banping>80 && b[i].ganbu=='Y')b[i].money+=850; } int k=0;int s=0; for(i=0;i<n;i++) { s=b[i].money+s; if(b[k].money<b[i].money)k=i; } cout<<b[k].name<<endl<<b[k].money<<endl<<s; return 0; }
-
02017-02-28 04:29:39@
#include <stdio.h>
int main()
{
int n,i;
scanf("%d", &i);
int a[i][5],highman=0; long haha[i],highmoney=0,addup=0;
char b[i][20],temp='Y';
for (n=0;n<i;n++)
{
scanf("%s %d %d", b[n],&a[n][0],&a[n][1]);
temp=getchar();
scanf("%c",&temp);
if (temp=='Y') a[n][2]=1;
else a[n][2]=0;temp=getchar();
scanf("%c",&temp);
if (temp=='Y') a[n][3]=1;
else a[n][3]=0;scanf("%d",&a[n][4]);
haha[n]=0;
if (a[n][0]>80&&a[n][4]>=1) haha[n]=haha[n]+8000;
if (a[n][0]>85&&a[n][1]>80) haha[n]=haha[n]+4000;
if (a[n][0]>90) haha[n]=haha[n]+2000;
if (a[n][0]>85&&a[n][3]==1) haha[n]=haha[n]+1000;
if (a[n][1]>80&&a[n][2]==1) haha[n]=haha[n]+850;if (haha[n]>highmoney) {highman=n; highmoney=haha[n];}
addup=addup+haha[n];
}
printf("%s\n%ld\n%ld\n", b[highman],haha[highman],addup);return 0;
} -
02017-02-28 04:29:28@
#include <stdio.h>
int main()
{
int n,i;
scanf("%d", &i);
int a[i][5],highman=0; long haha[i],highmoney=0,addup=0;
char b[i][20],temp='Y';
for (n=0;n<i;n++)
{
scanf("%s %d %d", b[n],&a[n][0],&a[n][1]);
temp=getchar();
scanf("%c",&temp);
if (temp=='Y') a[n][2]=1;
else a[n][2]=0;temp=getchar();
scanf("%c",&temp);
if (temp=='Y') a[n][3]=1;
else a[n][3]=0;scanf("%d",&a[n][4]);
haha[n]=0;
if (a[n][0]>80&&a[n][4]>=1) haha[n]=haha[n]+8000;
if (a[n][0]>85&&a[n][1]>80) haha[n]=haha[n]+4000;
if (a[n][0]>90) haha[n]=haha[n]+2000;
if (a[n][0]>85&&a[n][3]==1) haha[n]=haha[n]+1000;
if (a[n][1]>80&&a[n][2]==1) haha[n]=haha[n]+850;if (haha[n]>highmoney) {highman=n; highmoney=haha[n];}
addup=addup+haha[n];
}
printf("%s\n%ld\n%ld\n", b[highman],haha[highman],addup);return 0;
} -
02017-02-26 20:37:47@
新手题解
var
name,namezd:string;
pj,yp,lw,z,i,j,k:integer;
jxj,all,max:longint;
xsgb,xb,la,wa,x:char;
ha:boolean;
begin
readln(z); all:=0; max:=0;
for i:=1 to z do
begin
jxj:=0; j:=0; ha:=false; name:='';
read(x);
while x<>' ' do
begin
name:=name+x;
read(x);
end;
read(pj);
read(yp); read(la); read(xsgb); read(la); read(xb); read(wa); readln(lw);
if (pj>80) and (lw>=1) then jxj:=jxj+8000;
if (pj>85) and (yp>80) then jxj:=jxj+4000;
if (pj>90) then jxj:=jxj+2000;
if (pj>85) and (xb='Y') then jxj:=jxj+1000;
if (yp>80) and (xsgb='Y') then jxj:=jxj+850;
if jxj>max then
begin
namezd:=name;
max:=jxj;
end;
all:=all+jxj;
end;
writeln(namezd) ;
writeln(max);
writeln(all);
end. -
02017-02-06 23:57:03@
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> using namespace std; #define rank int inline int read(){ int x = 0 , f = 1;char ch = getchar(); for( ; !isdigit(ch) ; ch = getchar() ) if( ch == '-' ) f = -1; for( ; isdigit(ch) ; ch = getchar() ) x = x * 10 + ch - '0'; return x * f; } int ALL_STUDENT_SCHOLARSHIP; const int maxn = 110; bool MakeProChoise(char IsProForInput){ if(IsProForInput == 'Y'){ return true; } return false; } struct data{ string name; int id; int AvgEnd , AvgClass , NumPassage; bool IsWest , IsPro; int Scholarship; void input(rank ii){ id = ii; cin >> name; AvgEnd = read() , AvgClass = read(); char IsWestInput , IsProInput; scanf("%c %c",&IsProInput , &IsWestInput); IsPro = MakeProChoise(IsProInput) , IsWest = MakeProChoise(IsWestInput); NumPassage = read(); Scholarship = ((AvgEnd > 80 && NumPassage >= 1) ? 8000 : 0) + ((AvgEnd > 85 && AvgClass > 80) ? 4000 : 0) + ((AvgEnd > 90) ? 2000 : 0) + ((AvgEnd > 85 && IsWest) ? 1000 : 0) + ((AvgClass > 80 && IsPro) ? 850 : 0) ; ALL_STUDENT_SCHOLARSHIP += Scholarship; return ; } bool operator < (const data &k) const { return Scholarship < k.Scholarship; } }person[maxn]; int n; void output(){ cout << person[n].name << endl; printf("%d\n",person[n].Scholarship); printf("%d\n",ALL_STUDENT_SCHOLARSHIP); return ; } int main(){ n = read(); for(int i = 1 ; i <= n ; i ++){ person[i].input(i); } sort(person + 1 , person + n + 1); output(); }```
-
02017-01-31 22:54:14@
http://blog.csdn.net/noble_/article/details/54799029
我发的题解
c++的,AC -
02017-01-14 18:38:24@
这个错在哪了,我找不到啊!
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
struct student
{
string nam;
int score1;
int score2;
char ganbu;
char west;
int lunwen;
int money;
int a;
bool operator<(const student&t)const
{
if(money!=t.money)return money>t.money;
else return a<t.a;
}
};
student s[101];
int n,i,sum;
int main()
{
cin>>n;
sum=0;
for(i=0;i<n;i++)
{
cin>>s[i].nam>>s[i].score1>>s[i].score2>>s[i].ganbu>>s[i].west>>s[i].lunwen;
s[i].a=i;
s[i].money=0;
if((s[i].score1>80)&&(s[i].lunwen>0)) s[i].money=s[i].money+8000;
if((s[i].score1>85)&&(s[i].score2>80)) s[i].money=s[i].money+4000;
if(s[i].score1>90) s[i].money=s[i].money+2000;
if((s[i].score1>85)&&(s[i].west=='Y')) s[i].money=s[i].money+1000;
if((s[i].score1>80)&&(s[i].ganbu=='Y')) s[i].money=s[i].money+850;
sum=sum+s[i].money;
}
sort(s,s+n);
cout<<s[0].nam<<endl<<s[0].money<<endl<<sum<<endl;
return 0;
}测试数据 #0: Accepted, time = 0 ms, mem = 592 KiB, score = 10
测试数据 #1: WrongAnswer, time = 15 ms, mem = 588 KiB, score = 0
测试数据 #2: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
测试数据 #3: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
测试数据 #4: Accepted, time = 0 ms, mem = 588 KiB, score = 10
测试数据 #5: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
测试数据 #6: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
测试数据 #7: Accepted, time = 0 ms, mem = 584 KiB, score = 10
测试数据 #8: WrongAnswer, time = 0 ms, mem = 588 KiB, score = 0
测试数据 #9: WrongAnswer, time = 0 ms, mem = 592 KiB, score = 0
WrongAnswer, time = 15 ms, mem = 592 KiB, score = 30 -
02017-01-03 01:36:19@
最后一个条件打错数字。。。。。我不想说话了,附代码
测试数据 #0: Accepted, time = 0 ms, mem = 512 KiB, score = 10测试数据 #1: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 512 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 512 KiB, score = 10
Accepted, time = 0 ms, mem = 512 KiB, score = 100
```c++
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
int main()
{
int n,a,b,e,ch[101];
char name[21],maxname[21],c[2],d[2];
memset(ch,0,sizeof(ch));
scanf("%d",&n);
int max = 0,sum=0;;
for(int i=0;i<n;i++){
scanf("%s%d%d",&name,&a,&b);
getchar();
scanf("%s%s%d",&c,&d,&e);
if(a>80&&e>=1) ch[i] += 8000;
if(a>85&&b>80) ch[i] += 4000;
if(a>90) ch[i] += 2000;
if(a>85&&strcmp(d,"Y") == 0) ch[i] += 1000;
if(b>80&&strcmp(c,"Y") == 0) ch[i] += 850;
sum += ch[i];
if(ch[i] > max) {max = ch[i];strcpy(maxname,name);}
}
printf("%s\n%d\n%d",maxname,max,sum);
return 0 ;
} -
02016-11-17 16:42:22@
AC了!
向大家分享部分代码struct jia { string n; //姓名 int q,b,l,m; //期末成绩,班级成绩,论文,奖学金 char g,x; //干部,西部 }a[100]; for(i=0;i<n;i++) { if(a[i].q>80&&a[i].l>0) a[i].m=a[i].m+8000; if(a[i].q>85&&a[i].b>80) a[i].m=a[i].m+4000; if(a[i].q>90) a[i].m=a[i].m+2000; if(a[i].q>85&&a[i].x=='Y') a[i].m=a[i].m+1000; if(a[i].b>80&&a[i].g=='Y') a[i].m=a[i].m+850; if(a[i].m>max) max=a[i].m; }
希望能帮到你们!
-
02016-11-16 23:27:02@
#include<cstdio>
int n,s[101],k,h,sum;
struct node
{
char name[20];
int end;
int often;
char job;
char west;
int a;
}f[101];
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%s %d %d %c %c %d",f[i].name,&f[i].end,&f[i].often,&f[i].job,&f[i].west,&f[i].a);
if(f[i].end>80&&f[i].a>=1) s[i]+=8000;
if(f[i].end>85&&f[i].often>80) s[i]+=4000;
if(f[i].end>90) s[i]+=2000;
if(f[i].end>85&&f[i].west=='Y') s[i]+=1000;
if(f[i].often>80&&f[i].job=='Y') s[i]+=850;
sum+=s[i];
if(s[i]>k)
{
k=s[i];h=i;
}
}
puts(f[h].name);
printf("%d\n%d",s[h],sum);
} -
02016-11-08 19:45:34@
var a,b,c,d,e,f,g,h,i,n,j,sum,max:longint;
k:integer;
s,s1,ss:string;
begin
readln(n);
for i:=1 to n do
begin
h:=0;
readln(s);
s1:=copy(s,1,pos(' ',s)-1);
delete(s,1,pos(' ',s));
val(copy(s,1,pos(' ',s)-1),a,k);
delete(s,1,pos(' ',s));
val(copy(s,1,pos(' ',s)-1),b,k);
delete(s,1,pos(' ',s));
if s[1]='Y' then c:=1 else c:=0;
delete(s,1,2);
if s[1]='Y' then d:=1 else d:=0;
delete(s,1,2);
val(copy(s,1,length(s)),e,k);
if (a>80) and (e>0) then inc(h,8000);
if (a>85) and (b>80) then inc(h,4000);
if (a>90) then inc(h,2000);
if (a>85) and (d=1) then inc(h,1000);
if (b>80) and (c=1) then inc(h,850);
inc(sum,h);
//writeln(a,' ',b,' ',c,' ',d,' ',e,' ',h);
if h>max then begin max:=h; ss:=s1; end;
end;
writeln(ss);
writeln(max);
writeln(sum);
end.