511 条题解
-
32
刘锦钰是超神.. LV 8 @ 8 年前
-
44 年前@
快乐Python。有跟简单的方法吗?)
-
34 年前@
吐血了,这题目是有点问题的吧!
总感觉西部和班干部这里的金额反了。做了N次,出错。可能是我理解能力的问题吧!勿喷,谢谢。做得很一般,没有写得很精简,但是也不难理解。喜欢的老铁,帮忙点赞。谢谢 -
315 年前@
输入数据时千万要记得 占位符 加空格
scanf("%s %d %d %c %c %d"
-
24 年前@
python用**二维列表存数据**
注意题目**一个学生可能获得多个奖项**所以只用if语句 -
24 年前@
-
24 年前@
一道模拟题,用结构体struct存入每位学生的信息,之后一次判断即可。
注意:题目中说每位学生可以获得多项奖,所以使用if语句并列写,如题目中写每位学生只能获得最先拿到的一项奖,则应使用if……else语句!
-
25 年前@
竟然没有Pascal的题解,那我就来水一发
代码
-
25 年前@
-
18 个月前@
暴力解
-
11 年前@
温柔的结构体:)(C++)
-
12 年前@
纯暴力模拟
#include<bits/stdc++.h>
using namespace std;
string a[105];//姓名
short b[105],c[105];//期末成绩和班级评议成绩
char d[105];//是否学生干部
char e[105];//是否西部省份学生
short f[105];//论文数量
short g[105];//奖学金
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
short h;
cin>>h;
for(int i=0;i<h;i++)
{
cin>>a[i];
cin>>b[i];
cin>>c[i];
cin>>d[i];
cin>>e[i];
cin>>f[i];
g[i]=0;
if(b[i]>80&&f[i]>0) g[i]+=8000;
if(b[i]>85&&c[i]>80) g[i]+=4000;
if(b[i]>90) g[i]+=2000;
if(b[i]>85&&e[i]=='Y')g[i]+=1000;
if(c[i]>80&&d[i]=='Y')g[i]+=850;
}
int j=0,k,l=0;
for(int m=0;m<h;m++)
{
l+=g[m];
if(g[m]>j)
{
j=g[m];
k=m;
}
}
cout<<a[k]<<"\n"<<j<<"\n"<<l;
return 0;
}
压行后
#include<bits/stdc++.h>
using namespace std;string a[105];short b[105],c[105];char d[105];char e[105];short f[105];short g[105];int main(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);short h;cin>>h;for(int i=0;i<h;i++){cin>>a[i];cin>>b[i];cin>>c[i];cin>>d[i];cin>>e[i];cin>>f[i];g[i]=0;if(b[i]>80&&f[i]>0)g[i]+=8000;if(b[i]>85&&c[i]>80)g[i]+=4000;if(b[i]>90)g[i]+=2000;if(b[i]>85&&e[i]=='Y')g[i]+=1000;if(c[i]>80&&d[i]=='Y')g[i]+=850;}int j=0,k,l=0;for(int m=0;m<h;m++){l+=g[m];if(g[m]>j){j=g[m];k=m;}}cout<<a[k]<<"\n"<<j<<"\n"<<l;return 0;
-
12 年前@
普通模拟题
-
12 年前@
最短代码
有帮助的话请点个赞.
-
13 年前@
此题规范方法应是结构体排序:
-
13 年前@
#include<iostream>
#include<string.h>
using namespace std;
class Student
{
public:
string name, claS, westS;//姓名,是否为学生干部,是否为西部学生。
int Lscore , Cscore , paper ;
int money =0;
void Money();//判断条件
};
void Student::Money()
{
if (paper >= 1 && Lscore > 80)money += 8000;
if (Lscore > 85 && Cscore > 80)money += 4000;
if (Lscore > 90)money += 2000;
if (Lscore > 85 && westS == "Y")money += 1000;
if (Cscore > 80 &&claS == "Y")money += 850;
}
int main()
{string name;//获得奖金最多的人的名字
int N,money=0,allmoney=0;//获得奖金最多的人的钱,所有人的奖金和
cin >> N;
for (int i = 0; i < N; i++)
{
Student stu;
cin >> stu.name >> stu.Lscore >> stu.Cscore >> stu.claS >> stu.westS >> stu.paper;
stu.Money();
allmoney += stu.money;
if (stu.money > money)
{
money = stu.money; name = stu.name;
}
}
cout << name << endl;
cout << money << endl;
cout << allmoney << endl;
return 0;
} -
13 年前@
#include <iostream>\我这样写应该会更加通俗易懂/
#include <cstring>
using namespace std;
int main()
{
string a,c;
char g,d;
long n,l,z,y,w=0,h=0,temp=0,num=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a;
cin>>l;
cin>>z;
cin>>g;
cin>>d;
cin>>y;
if(l>80&&l<=100&&y>=1)
w=w+8000;
if(l>85&&l<=100&&z>80)
w=w+4000;
if(l>90&&l<=100)
w=w+2000;
if(d=='Y'&&l<=100&&l>85)
w=w+1000;
if(g=='Y'&&z<=100&&z>80)
w=w+850;
if(w>temp)
{
temp=w;
c=a;
}
if(w==temp)
{
h++;
}
num=num+w;
w=0;
}
cout<<c<<endl;
cout<<temp<<endl;
cout<<num<<endl;
} -
13 年前@
#include <iostream>\我这样写应该会更加通俗易懂/
#include <cstring>
using namespace std;
int main()
{
string a,c;
char g,d;
long n,l,z,y,w=0,h=0,temp=0,num=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a;
cin>>l;
cin>>z;
cin>>g;
cin>>d;
cin>>y;
if(l>80&&l<=100&&y>=1)
w=w+8000;
if(l>85&&l<=100&&z>80)
w=w+4000;
if(l>90&&l<=100)
w=w+2000;
if(d=='Y'&&l<=100&&l>85)
w=w+1000;
if(g=='Y'&&z<=100&&z>80)
w=w+850;
if(w>temp)
{
temp=w;
c=a;
}
if(w==temp)
{
h++;
}
num=num+w;
w=0;
}
cout<<c<<endl;
cout<<temp<<endl;
cout<<num<<endl;
} -
14 年前@
-
15 年前@
#include<stdio.h>
#include<math.h>
#include<string.h>
typedef struct{
char name[20];
int finalscore;
int classscore;
char bgb;
char west;
int essay;
int money;
}S;
S student[10];
int main()
{
int N,i,flag;
long sum=0;
int max=0;
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%s %d %d %c %c %d",student[i].name,&student[i].finalscore,&student[i].classscore,&student[i].bgb,&student[i].west,&student[i].essay);
student[i].money=0;
}
for(i=0;i<N;i++)
{
if(student[i].finalscore>80&&student[i].essay)
student[i].money+=8000;
if(student[i].finalscore>85&&student[i].classscore>80)
student[i].money+=4000;
if(student[i].finalscore>90)
student[i].money+=2000;
if(student[i].finalscore>85&&student[i].west=='Y')
student[i].money+=1000;
if(student[i].classscore>80&&student[i].bgb=='Y')
student[i].money+=850;
}
for(i=0;i<N;i++)
{
sum+=student[i].money;
}
for(i=0;i<N;i++){
if(max<student[i].money){
max=student[i].money;
flag=i;
}
}
printf("%s\n",student[flag].name);
printf("%d\n",student[flag].money);
printf("%d",sum);
return 0;
}