沙雕模拟
1 2015011233 M 34 14'30" P 3 3 8 20170508 2015011233 17:02:33 17:19:33 2.99 0'0" 3333 20170509 2015011233 17:12:15 17:38:46 3.01 2'3" 4300 20170510 2015011233 22:03:06 22:13:08 3.05 0'0" 2772 20170511 2015011233 22:08:05 22:28:13 3.02 5'3" 3775 20170512 2015011233 18:03:12 18:17:56 3.02 0'0" 2001 20170513 2015011233 17:30:23 17:46:08 3.01 0'0" 3020 20170513 2015011233 22:03:34 22:20:08 3.04 2'0" 3058 20170514 2015011233 07:16:22 07:32:34 3.00 0'0" 3244
1 2015011233 59 F
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <cstdio> 2 #include <cstdlib> 3 #include <map> 4 #include <string> 5 #include <vector> 6 #include <iostream> 7 #define eps 1e-9 8 using namespace std; 9 typedef long long LL; 10 map<LL, bool> gender;//sex m boy 1 f girl 0 11 map<LL, int> score; 12 map<LL, int> sunshine_run_cnt; 13 map<LL, LL> sunshine_run_date; 14 map<LL, int> sunshine_end_time; 15 map<LL, int> traning_camp_cnt; 16 vector<LL> stu_id; 17 int long_run_table[5][10] = {{12, 13, 13, 14, 14, 15, 15, 16, 17, 18}, 18 {30, 0, 30, 0, 30, 10, 50, 30, 10, 0}, 19 { 6, 6, 7, 7, 7, 8, 8, 8, 8, 9}, 20 {40, 57, 14, 31, 50, 5, 20, 35, 50, 0}, 21 {20, 18, 16, 14, 12, 10, 8, 6, 4, 2}};//长跑测试 22 int sunshine_run_table[2][7] = {{21, 19, 17, 14, 11, 7, 3}, 23 {10, 9, 8, 7, 6, 4, 2}}; 24 int traning_camp_table[2][5] = {{18, 15, 12, 9, 6}, 25 { 5, 4, 3, 2, 1}};//班级训练营 26 int gpa_table[11] = {95, 90, 85, 80, 77, 73, 70, 67, 63, 60, 0};//分数区间 27 string grade_table[11] = {"A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "F"}; 28 int main(int argc, char* argv[]) { 29 freopen("score.in", "r", stdin); 30 freopen("score.out", "w", stdout); 31 int n; 32 scanf("%d", &n); 33 for (int i = 0; i < n; i++) { 34 LL id; 35 char g, p; 36 int s1, a, b, s2, cnt; 37 scanf("%lld %c %d %d\'%d\" %c %d %d", &id, &g, &s1, &a, &b, &p, &s2, &cnt); 38 stu_id.push_back(id); 39 gender[id] = g == 'M' ? 1 : 0;// 你是mm 还是 gg?(突然非主流) 40 score[id] += s1;//体育课专项成绩 41 for (int j = 0; j < 10; j++) 42 if ((g == 'M' && a * 60 + b <= long_run_table[0][j] * 60 + long_run_table[1][j]) || 43 (g == 'F' && a * 60 + b <= long_run_table[2][j] * 60 + long_run_table[3][j])) { 44 score[id] += long_run_table[4][j]; 45 break; 46 }//长跑测试 47 score[id] += p == 'P' ? 10 : 0;//体质测试 48 score[id] += s2;//期末检测成绩 49 traning_camp_cnt[id] = cnt;//班级训练营 50 } 51 int m;//sun run 52 scanf("%d", &m); 53 for (int i = 0; i < m; i++) { 54 LL date, id; 55 double dis; 56 scanf("%lld %lld %d:%d:%d %d:%d:%d %lf %d\'%d\" %d", &date, &id, &h0, &m0, &s0, &h1, &m1, &s1, &dis, &a, &b, &step);//这题输入处理太重要啦 57 if ((gender[id] && dis + eps < 3.0) || (!gender[id] && dis + eps < 1.5)) continue//阳光长跑长度,不够直接不再处理; 58 double delta_t = (h1 - h0) * 3600 + (m1 - m0) * 60 + (s1 - s0);//时间 59 double v = dis * 1000 / delta_t, stride = dis * 1000 / step;//速度 步频 60 if (v < 2.0 - eps || v > 5.0 + eps) continue;//速度判断 61 if (a * 60 + b > 270) continue;//暂停时间判断 62 if (stride > 1.5 + eps) continue;//步频判断 63 int start_sec = h0 * 3600 + m0 * 60 + s0; 64 int end_sec = h1 * 3600 + m1 * 60 + s1; 65 if (sunshine_run_date[id] == date && start_sec - sunshine_end_time[id] < 3600 * 6) continue;//间隔6h 66 sunshine_run_cnt[id]++;//长跑次数 67 sunshine_run_date[id] = date;//记录上次是什么时候跑的 day 68 sunshine_end_time[id] = end_sec;//记录结束时间,辅助判断间隔6h 69 } 70 int tot[11]; 71 for (int i = 0; i < 11; i++) tot[i] = 0; 72 for (int i = 0; i < n; i++) { 73 LL id = stu_id[i]; 74 for (int j = 0; j < 7; j++) 75 if (sunshine_run_cnt[id] >= sunshine_run_table[0][j]) {//阳光长跑 76 score[id] += sunshine_run_table[1][j]; 77 break; 78 } 79 for (int j = 0; j < 5; j++) 80 if (sunshine_run_cnt[id] + traning_camp_cnt[id] >= traning_camp_table[0][j]) {//专项成绩 81 score[id] += traning_camp_table[1][j]; 82 break; 83 } 84 string grade; 85 for (int j = 0; j < 11; j++) 86 if (score[id] >= gpa_table[j]) { 87 grade = grade_table[j]; 88 tot[j]++;//调试用 89 break; 90 } 91 cout << id << ' ' << score[id] << ' ' << grade << endl; 92 } 93 return 0; 94 } 95