稍微看下题目
很明显,本题是一个大模拟·····
那就不多说了,上思路!!!
我的思路是——(没思路)题目咋说咱咋来(( ̄▽ ̄)*)。
定义:
针对此题,我们可以构造两个结构体 和 ,分别表示每位学生和每次的“阳光长跑”。
输入:
题目有说,就按照题目表述来构造代码就行了(~ ̄▽ ̄)~。
Solve:
、对于每一个学生来说,我们可以直接将其的体育课专项成绩和「大一专项计划」的期末检测成绩直接加入这位学生的总分数。
、对于每一个学生来说,我们可以通过题目给出的判断条件将其的体质测试成绩、期末长跑测试成绩计算出来,而后加入这位学生的总分数。
、对于每一个学生来说,最难也是最重要的就是其的“阳光长跑”:
判断其的性别,然后再根据题目给的判断条件判断是否合法
判断其的平均速度、总暂停时间、平均步幅是否合法。
与其上一次的合法记录进行比较,判断是否合法。(用两个数组存储每一个学生的上一条合法记录的完成日期和时间)。
、利用题目中的判断条件判断每一位学生“阳光长跑”的成绩和「大一专项计划」的出勤分,然后加入该学生的总分数。
、利用题目中的“百分制成绩与等级、绩点”,算出每位学生的等级。
Code
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=11111,maxm=2e5;
int read() {
int x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch))f = ch == '-' ? -1 : 1, ch = getchar();
while (isdigit(ch))x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
return x * f;
}
void write(int x) {
if (x < 0) x = -x, putchar('-');
if (x > 9) write(x / 10);
putchar(x % 10 + '0');
}
struct student{
int id;
char sex;
int mark_PE;
int runpts;
char body;
int fin;
int cla;
int mark;
int lastdate;
int lasttime;
int timess;
}a[maxn];
struct run
{
int day;
int id;
int start;
int end;
double dis;
int stop;
int step;
}b[maxm];
int runptsboy(int x)
{
if(x<=750)return 20;
if(x<=780)return 18;
if(x<=810)return 16;
if(x<=840)return 14;
if(x<=870)return 12;
if(x<=910)return 10;
if(x<=950)return 8;
if(x<=990)return 6;
if(x<=1030)return 4;
if(x<=1080)return 2;
return 0;
}
int runptsgirl(int x)
{
if(x<=400)return 20;
if(x<=417)return 18;
if(x<=434)return 16;
if(x<=451)return 14;
if(x<=470)return 12;
if(x<=485)return 10;
if(x<=500)return 8;
if(x<=515)return 6;
if(x<=530)return 4;
if(x<=540)return 2;
return 0;
}
map<int,int>mp;
bool sunrunning(int x){
if(b[x].dis/(b[x].end-b[x].start)<2||b[x].dis/(b[x].end-b[x].start)>5) return false;
if(b[x].stop>270) return false;
if(b[x].dis/b[x].step>1.5) return false;
if(a[mp[b[x].id]].sex=='M')
if(b[x].dis<3000) return false;
if(a[mp[b[x].id]].sex=='F')
if(b[x].dis<1500) return false;
if(b[x].day==a[mp[b[x].id]].lastdate)
if(b[x].start-21600<a[mp[b[x].id]].lasttime) return false;
if(b[x].day-1==a[mp[b[x].id]].lastdate)
if(b[x].start+(86400-a[mp[b[x].id]].lasttime)<21600) return false;
a[mp[b[x].id]].lastdate=b[x].day;
a[mp[b[x].id]].lasttime=b[x].end;
return true;
}
int SunRun(int x){
if(x>=21) return 10;
if(x>=19) return 9;
if(x>=17) return 8;
if(x>=14) return 7;
if(x>=11) return 6;
if(x>=7) return 4;
if(x>=3) return 2;
return 0;
}
int work(int x){
if(x>=18) return 5;
if(x>=15) return 4;
if(x>=12) return 3;
if(x>=9) return 2;
if(x>=6) return 1;
return 0;
}
string grade(int x){
if(x>=95) return "A";
if(x>=90) return "A-";
if(x>=85) return "B+";
if(x>=80) return "B";
if(x>=77) return "B-";
if(x>=73) return "C+";
if(x>=70) return "C";
if(x>=67) return "C-";
if(x>=63) return "D+";
if(x>=60) return "D";
return "F";
}
int n,m;
main() {
n=read();
for (int i = 1; i <= n; i++) {
a[i].id=read();cin>>a[i].sex;a[i].mark_PE=read();
int x, y;char c;
mp[a[i].id] = i;
scanf("%lld%c%lld%c%c", &x, &c, &y, &c, &c);
a[i].runpts = x * 60 + y;
cin >> a[i].body;a[i].fin=read();a[i].cla=read();
if (a[i].sex == 'M')a[i].mark += runptsboy(a[i].runpts);
else a[i].mark += runptsgirl(a[i].runpts);
a[i].mark += a[i].mark_PE;
a[i].mark+= a[i].fin;
if (a[i].body == 'P') a[i].mark+= 10;
}
m=read();
for (int i = 1; i <= m; i++) {
int x, y, z;char c;
b[i].day=read();b[i].id=read();
scanf("%lld:%lld:%lld", &x, &y, &z);
b[i].start = x * 3600 + y * 60 + z;
scanf("%lld:%lld:%lld", &x, &y, &z);
b[i].end = x * 3600 + y * 60 + z;
cin >> b[i].dis;
b[i].dis*=1000.0;
scanf("%lld%c%lld%c%c", &x, &c, &y, &c, &c);
b[i].stop = x * 60 + y;
b[i].step=read();
if(sunrunning(i)) a[mp[b[i].id]].timess++;
}
for(int i=1;i<=n;i++){
a[i].mark+=SunRun(a[i].timess);
a[i].mark+=work(a[i].timess+a[i].cla);
string s=grade(a[i].mark);
printf("%lld %lld ",a[i].id,a[i].mark);
cout<<s;
puts("");
}
return 0;
}