• 10.6 体育成绩统计


    10.6 模拟赛

    T1 (LOJ 2404 体育成绩统计)

    题意很简单 模拟就行了

    注意事项 :

    1. 写函数把字符串化成秒, 一定要看清字符串的格式和特点, 比如说前面0是一位, 最后没有字符之类的
    2. 比较和判分的函数 一定记得返回0;(表示死在这里)
    3. 边读入边算是最好的解决方案, 存起来会很麻烦
    4. if else 可换为数组存(无所谓)
    5. 调试要有耐心, (可以把给的大样例里某个人扒出来)
    6. 从主函数开始一步一步调试, 这样才有更大的一次成功的把握
    7. 面对这些读入题 我们选择scanf格式读入(考场上忘了这个骚操作, 还傻傻的处理字符窜。。。)
    8. 单双引号读入输出处理' ' " "

    丑陋的代码(调了多半天, 所以码风怪)

    #include <bits/stdc++.h>
    using namespace std;
    int n, m;
    map<string, int> mp;
    struct zz
    {
    	string id1;// 学号 
    	int xb;    //  性别 
    	int sc1;    // 体育课专项成绩 
    	int s2;   //期末长跑测试成绩
    	int s3;    // 体质有没有通过
    	int s4;    // 大一专项计划期末成绩
    	int s5;    //  参加班级训练营的次数 
    	int s6;     // 阳光长跑次数 
    	int last;
    	int sum;
    }f[4005];
    int solve(string x)
    {
    	int i = 0, ans1 = 0,ans2 = 0;
    	for(; i < x.size(); ++ i)
    	{
    		if(x[i] < '0' || x[i] > '9') break;
    		ans1 = ans1 * 10 + x[i] - '0';
    	}
    	++ i;
    	for(;i < x.size(); ++ i)
    	{
    	    if(x[i] < '0' || x[i] > '9') break;
    		ans2 = ans2 * 10 + x[i] - '0' ;
    	}
    	return ans1 * 60 + ans2;
    }
    int ss(string x)
    {
    	int i = 0, ans1 = 0, ans2 = 0, ans3 = 0;
    	for(; i < x.size(); i ++)
    	{
    		if(x[i] < '0' || x[i] > '9') break;
    		ans1 = ans1 * 10 + x[i] - '0';
    	}
    	i ++;
    	for(; i < x.size(); i ++)
    	{
    		if(x[i] < '0' || x[i] > '9') break;
    		ans2 = ans2 * 10 + x[i] - '0';		
    	}
    	i ++;
    	for(; i < x.size(); i ++)
        	ans3 = ans3 * 10 + x[i] - '0';
    	return ans1 * 3600 + ans2 * 60 + ans3;
    }
    int ti(int a,int b){return a*60+b;}
    int emm(int x)
    {
    	if(f[x].xb == 1)
    	{
    		if(f[x].s2 <= 12 *60 + 30) return 20;
    		else if(f[x].s2 <= 13 *60) return 18;
    		else if(f[x].s2 <= 13 *60 + 30) return 16;
    		else if(f[x].s2 <= 14 * 60) return 14;
    		else if(f[x].s2 <= 14 * 60 + 30) return 12;
    		else if(f[x].s2 <= 15 * 60 + 10) return 10;
    		else if(f[x].s2 <= 15 *60 + 50) return 8;
    		else if(f[x].s2 <= 16 * 60 + 30) return 6;
    		else if(f[x].s2 <= 17 *60 + 10) return 4;
    		else if(f[x].s2 <= 18 * 60) return 2;
    
     	}
     	else
    	{
    		if(f[x].s2 <= 6 *60 + 40) return 20;
    		else if(f[x].s2 <= 6 *60 + 57) return 18;
    		else if(f[x].s2 <= 7 *60 + 14) return 16;
    		else if(f[x].s2 <= 7 * 60 + 31) return 14;
    		else if(f[x].s2 <= 7 * 60 + 50) return 12;
    		else if(f[x].s2 <= 8 * 60 + 5) return 10;
    		else if(f[x].s2 <= 8 *60 + 20) return 8;
    		else if(f[x].s2 <= 8 * 60 + 35) return 6;
    		else if(f[x].s2 <= 8 *60 + 50) return 4;
    		else if(f[x].s2 <= 9 * 60) return 2;
     	}
     	return 0;
    }
    int emm2(int x)
    {
    	if(f[x].s6 >= 21) return 10;
    	else if(f[x].s6 >= 19) return 9;
    	else if(f[x].s6 >= 17) return 8;
    	else if(f[x].s6 >= 14) return 7;
    	else if(f[x].s6 >= 11) return 6;
    	else if(f[x].s6 >= 7) return 4;
    	else if(f[x].s6 >= 3) return 2;
    	return 0;
    }
    int emm3(int x)
    {
    	int o = f[x].s5 + f[x].s6;
    //	cout << o <<endl;
    	if(o >= 18) return 5;
    	else if(o >= 15) return 4;
    	else if(o >= 12) return 3;
    	else if(o >= 9) return  2;
    	else if(o >= 6) return 1;
    	return 0;
    }
    char tmp[10];
    string  tmp1;
    int tot = 0;
    struct yy
    {
    	int date;
    	string End;	
    }mm[150005];
    string sta, End, id;
    double l;
    string temp;
    int step, date;
    double ll;
    int cnt;
    signed main()
    {
    	freopen("a.in", "r", stdin);
    	freopen("a.out", "w", stdout);
    	scanf("%d", &n);
    	for(int i = 1; i <= n; i ++)
    	{
    		cin >> f[i].id1;  
    		mp[f[i].id1] = i;
    		scanf("%s", tmp + 1);  f[i].xb = (tmp[1] == 'M'? 1 : 2); //1是男的 
    		scanf("%d", &f[i].sc1);
    		cin >> tmp1; f[i].s2 = solve(tmp1);
    		scanf("%s", tmp + 1);   f[i].s3 = (tmp[1] == 'P'? 10 : 0); //1是通过
    		scanf("%d", &f[i].s4);
    		scanf("%d", &f[i].s5); 
    	}
    	scanf("%d",&m);
    	for(int i = 1; i <= m; i ++)
    	{
    		cin >> date;
    		cin >> id;
    		cin >> sta;
    		cin >> End;
    	    cin >> l; 
    		ll = l * 1000;
    		cin >> temp;
    		cin >> step;
    		
    		int x = mp[id];
    		if((f[x].xb == 1&& ll < 3000.0)||(f[x].xb == 2&&ll < 1500.0)) continue;
    		double t = ss(End) - ss(sta);
    		double v = ll / (double)t;
    //		cout << v  << endl;
    		if(v < (double)2.0 || v > (double) 5.0 ) continue;
    //		cout << solve(temp) <<endl;
    		if(solve(temp) > 270) continue;
    		
    		double s = (double)ll / (double)step ;
    //		cout << s <<endl;
    		if(s > 1.5) continue;
    		int o = f[x].last; 
    		if(o == 0){
    			mm[++tot].date = date; mm[tot].End = End;
    			f[x].last = tot;
    			f[x].s6 ++;
    			continue;
    		}
            if(mm[o].date == date &&ss(sta) - ss(mm[o].End) < 6 * 3600) continue;
            if(date - mm[o].date <= 1 && ss(sta) + 24 * 3600 - ss(mm[o].End) < 6 * 3600) continue;
            mm[++tot].date = date;
    		mm[tot].End = End;
            f[x].last = tot;
            f[x].s6 ++;
    	}
    	for(int i = 1; i <= n; i ++)
    	{
    		f[i].sum += f[i].sc1;
    		f[i].sum += emm(i);
    		f[i].sum += emm2(i);
    		f[i].sum += f[i].s3;
    		f[i].sum += f[i].s4;
    		f[i].sum += emm3(i);
    	}
    	for(int i = 1; i <= n; i ++)
    	{
    		cout << f[i].id1 << " " << f[i].sum <<" ";
    //		cout << f[i].sc1 << " " << emm(i) << " " << emm2(i) << " " <<  f[i].s3 << " " << f[i].s4 << " " << emm3(i)<<endl;;
    //         cout <<f[i].s5 + f[i].s6 <<endl;
    		if(f[i].sum >= 95) {cout<<"A"<<"
    ";continue;}
    			if(f[i].sum >= 90) {
    			cout<<"A-"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 85) {
    			cout<<"B+"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 80) {
    			cout<<"B"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 77) {
    			cout<<"B-"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 73) {
    			cout<<"C+"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 70) {
    			cout<<"C"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 67) {
    			cout<<"C-"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 63) {
    			cout<<"D+"<<"
    ";
    			continue;
    		}
    			if(f[i].sum >= 60) {
    			cout<<"D"<<"
    ";
    			continue;
    		}
    		else{
    			cout<<"F"<<"
    ";
    			continue;
    		}
    	}
    	return 0;
    }
    
  • 相关阅读:
    c#无边框窗体移动 屏蔽双击最大化
    怎么样让代码都带有注释?
    权限设置相关,利用Microsoft.Win32.Security
    计算几何常用算法概览[转]
    VS 常见快捷键
    关于读取txt文件的分段问题
    ajax 常用方法
    文件以附件形式下载的方法
    半角和全角互换
    在ubuntu 中安装 jsdoc
  • 原文地址:https://www.cnblogs.com/spbv587/p/11629288.html
Copyright © 2020-2023  润新知