有没有好心人帮忙改一下代码啊QwQ
  • 板块题目总版
  • 楼主__KevinMZ__
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/8/19 21:45
  • 上次更新2024/8/20 09:33:22
查看原帖
有没有好心人帮忙改一下代码啊QwQ
1358215
__KevinMZ__楼主2024/8/19 21:45

改不出一点

#include <bits/stdc++.h>
using namespace std;
int n, m;
char ls;
struct run
{
	long long time, date;
};
struct stu
{
	long long id;//学号 
	char sex;//性别,Male,Female 
	int score;//专项成绩 
	int min, sec;//跑步的时间 
	char phy;//体质测试是否通过,Pass,Fail 
	int tl;//期末的分数 
	int times;//参加班级训练营的次数 
	int run_pass;//阳光长跑通过的次数 
	run last;
	Stu()
	{
		this->last.date = -LLONG_MAX;
		this->last.time = 0; 
		cin >> this->id >> this->sex >> this->score >> this->min >> ls >> this->sec >> ls >> this->phy >> this->tl >> this->times;
//		cout << this->id << " " << this->sex << " " << this->score << " " << this->min << " " << this->sec << " " << this->phy << " " << this->tl << " " << this->times << "\n";
	}
}a[10010];
int bs(long long id)
{
	int l = 1, r = n, mid;
	while(l < r)
	{
		mid = (l + r) >> 1;
		if(a[mid].id > id) r = mid;
		else if(a[mid].id < id) l = mid + 1;
		else{l = mid;break;}
	}
	return l;
}
void input()
{
	long long id, date;
	int h1, h2, m1, m2, s1, s2, rm, rs, steps;
	double kms;
	cin >> date >> id >> h1 >> ls >> m1 >> ls >> s1 >> h2 >> ls >> m2 >> ls >> s2 >> kms >> rm >> ls >> rs >> ls >> steps;
	stu *p = &a[bs(id)];
	if(!((p->sex == 'M' && kms < 3 || p->sex == 'F' && kms < 1.5) /*距离*/ ||
		(date - p->last.date) * 86400 + (h1 * 3600 + m1 * 60 + s1) - p->last.time < 21600 /*时间*/ ||
		rm * 60 + rs > 270/*暂停时间*/ ||
		(kms * 1000 / ((h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1) - (rm * 60 + rs))) < 2 ||
		(kms * 1000 / ((h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1) - (rm * 60 + rs))) > 5/*速度*/ ||
		kms * 1000 / steps > 1.5/*步幅*/ ))
	{
		(p->run_pass)++;
		p->last.date = date; p->last.time = h2 * 3600 + m2 * 60 + s2;//更新数据 
	}
//	cout << (!((p->sex == 'M' && kms < 3 || p->sex == 'F' && kms < 1.5) /*距离*/ ||
//		(date - p->last.date) * 86400 + p->last.time - (h1 * 3600 + m1 * 60 + s1) < 21600 /*时间*/ ||
//		rm * 60 + rs > 270/*暂停时间*/ ||
//		(kms * 1000 / ((h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1) - (rm * 60 + rs))) < 2 ||
//		(kms * 1000 / ((h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1) - (rm * 60 + rs))) > 5/*速度*/ ||
//		kms * 1000 / steps > 1.5/*步幅*/ )) << "\n";
//	cout << (p->sex == 'M' && kms < 3 || p->sex == 'F' && kms < 1.5) << " ";
//	cout << (((date - p->last.date) * 86400 + (h1 * 3600 + m1 * 60 + s1) - p->last.time)) << " " << date << " " << p->last.date << " " << h1 << " " << m1 << " " << s1 << " " << p->last.time << "\n";
//	cout << (rm * 60 + rs > 270) << " ";
//	cout << ((kms * 1000 / ((h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1) - (rm * 60 + rs))) < 2 || (kms * 1000 / ((h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1) - (rm * 60 + rs))) > 5) << " ";
//	cout << (kms * 1000 / steps > 1.5) << "\n";
}
inline int time(int min, int sec)
{
	return min * 60 + sec;
}
int running__score(int id)
{
	int t = time(a[id].min, a[id].sec);
	if(a[id].sex == 'M')
	{
		if(t <= time(12, 30)) return 20;
		if(t <= time(13, 00)) return 18;
		if(t <= time(13, 30)) return 16;
		if(t <= time(14, 00)) return 14;
		if(t <= time(14, 30)) return 12;
		if(t <= time(15, 10)) return 10;
		if(t <= time(15, 50)) return 8;
		if(t <= time(16, 30)) return 6;
		if(t <= time(17, 10)) return 4;
		if(t <= time(18, 00)) return 2;
		return 0;
	}
	else
	{
		if(t <= time(6, 40)) return 20;
		if(t <= time(6, 57)) return 18;
		if(t <= time(7, 14)) return 16;
		if(t <= time(7, 31)) return 14;
		if(t <= time(7, 50)) return 12;
		if(t <= time(8, 05)) return 10;
		if(t <= time(8, 20)) return 8;
		if(t <= time(8, 35)) return 6;
		if(t <= time(8, 50)) return 4;
		if(t <= time(9, 00)) return 2;
		return 0;
	}
}
int sunshine_score(int id)
{
	int t = a[id].run_pass;
	if(t >= 21)return 10;
	if(t >= 19) return 9;
	if(t >= 17) return 8;
	if(t >= 14) return 7;
	if(t >= 11) return 6;
	if(t >= 7)  return 4;
	if(t >= 3)  return 2;
				return 0;
}
int planning_score(int id)
{
	int t = a[id].run_pass + a[id].times;
	int tl = a[id].tl;
	if(t >= 18) return 5 + tl;
	if(t >= 15) return 4 + tl;
	if(t >= 12) return 3 + tl;
	if(t >= 9)  return 2 + tl;
	if(t >= 6)  return 1 + tl;
	return tl;
}
int all__in__score(int id)
{
//	cout << a[id].score << " " << running__score(id) << " " << sunshine_score(id) << " " << (a[id].phy == 'P'? 10 : 0) << " " << planning_score(id) << "\n";
	int x = a[id].score +
	running__score(id) +
	sunshine_score(id) +
	(a[id].phy == 'P'? 10 : 0) +
	planning_score(id);
	return x;
}
string		 grade(int id)
{
	int s = all__in__score(id);
//	cout << s << "\n";
	if(s >= 95) return "A";
	if(s >= 90) return "A-";
	if(s >= 85) return "B+";
	if(s >= 80) return "B";
	if(s >= 77) return "B-";
	if(s >= 73) return "C+";
	if(s >= 70) return "C";
	if(s >= 67) return "C-";
	if(s >= 63) return "D+";
	if(s >= 60) return "D";
				return "F";
}
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		a[i].Stu();
		cout << a[i].id << " " << a[i].sex << " " << a[i].score << " " << a[i].min << " " << a[i].sec << " " << a[i].phy << " " << a[i].tl << " " << a[i].times << "\n";
	}
	
	cin >> m;
//	cout << m << "\n"; 
	for(int i = 1; i <= m; i++)
	{
		input();
	}
	for(int i = 1; i <= n; i++)
	{
		cout << a[i].id << " " << all__in__score(i) << " " << grade(i) << "\n";
	}
    return 0;
}
2024/8/19 21:45
加载中...