Skip the Class
Posted 多一份不为什么的坚持
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Skip the Class相关的知识,希望对你有一定的参考价值。
BestCoder Round #92
Skip the Class
Accepts: 678
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <cstring> #include <algorithm> #include <cstdlib> #define FOR(i,x,n) for(int i=x;i<n;i++) #define ll long long int #define INF 0x3f3f3f3f #define MOD 1000000007 #define MAX_N 50005 using namespace std; struct node{ char course[20]; int v; }; node no[150]; int compar(char a[],char b[]){ int aa=strcmp(a,b); if(aa>0){ return 1; } return 0; } int compar2(char a[],char b[]){ int aa=strcmp(a,b); if(aa==0){ return 1; } return 0; } int cmp(node a,node b){ return compar(a.course,b.course)||compar2(a.course,b.course)&&a.v>b.v; } int main() { //freopen("data.txt", "r", stdin); //freopen("data.out", "w", stdout); int T; int n; scanf("%d",&T); while(T--){ scanf("%d",&n); FOR(i,0,n){ scanf("%s ",&no[i].course); scanf("%d",&no[i].v); } sort(no,no+n,cmp); int cou; int sum=0; sum+=no[0].v; cou=1; FOR(i,1,n){ if(compar2(no[i].course,no[i-1].course)){ if(cou==1){ sum+=no[i].v; cou++; }else{ continue; } }else{ sum+=no[i].v; cou=1; } } printf("%d\n",sum); } //fclose(stdin); //fclose(stdout); return 0; }
以上是关于Skip the Class的主要内容,如果未能解决你的问题,请参考以下文章
hdu 2019多校 Just Skip The Problem
环境初始化 Build and Install the Apache Thrift IDL Compiler Install the Platform Development Tools(代码片段
maven web项目的web.xml报错The markup in the document following the root element must be well-formed.(代码片段