真心是道水题,但找bug找的我想剁手了/(ㄒoㄒ)/~~

注意几个坑点,

1、输入,getline(cin); / gets(); 一行输入,注意前面要加getchar();

   输入运行记录的时候可以采取scanf("%d %c %d %c");的方式,因为已经说一个整型数后面只有一个空格;

2、该场没人出题时,队伍的得分是0;

某支队伍j比0场时,T[j] = 0;

3、如果前两支队伍出题数与罚时都相同,排名并列第1;后面的队伍从3开始排;

基本上没有了吧...被恶心到了。本应该出的题又被自己的粗心祸害了。这次比的仍是很糟,希望尽快好起来。。。

 #include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
#define ll long long
#define _cle(m, a) memset(m, a, sizeof(m))
#define repu(i, a, b) for(int i = a; i < b; i++)
#define repd(i, a, b) for(int i = b; i >= a; i--)
#define sfi(n) scanf("%d", &n)
#define sfl(n) scanf("%I64d", &n)
#define pfi(n) printf("%d\n", n)
#define pfl(n) printf("%I64d\n", n)
#define MAXN 105
const int maxn = ;
const int maxm = ;
string Name[maxn]; struct TEAM
{
int id;
int Time;
int pro;
TEAM(int _x = , int _pro = , int _t = ):id(_x), pro(_pro), Time(_t) {}
bool operator < (const TEAM& rhs) const
{
if(rhs.pro != pro) return rhs.pro < pro;
else return Time < rhs.Time;
}
};
struct Score
{
int id;
double s;
Score(int _x = , double _s = 0.0) : id(_x), s(_s) {}
bool operator < (const Score& rhs) const
{
return rhs.s < s;
}
}; int C[maxn]; //i队参加比赛的次数
double S[maxn];
double RS[maxn];
double T[maxn];
int wa[maxn][]; //i队j题的WA次数 int main()
{
int Kase;
scanf("%d", &Kase);
for(int kk = ; kk <= Kase; kk++)
{
memset(C, , sizeof(C));
memset(S, , sizeof(S));
memset(RS, , sizeof(RS));
memset(T, , sizeof(T)); int n; scanf("%d", &n);
getchar();
int maxl = ;
for(int i = ; i <= n; i++)
{
getline(cin, Name[i]);
int len = Name[i].length();
maxl = max(maxl, len);
}
int m; scanf("%d", &m); for(int i = ; i <= m; i++)
{
int P[maxn]; //i队解决的问题数
int Time[maxn]; //i队罚时
int K; scanf("%d", &K); //第i场参加队伍数
int A = *K-, B = K-;
vector<int> team;
for(int j = ; j < K; j++)
{
int t;
scanf("%d", &t); team.push_back(t);
C[t]++;
}
int pn; scanf("%d", &pn);
int in; scanf("%d", &in);
memset(wa, , sizeof(wa));
while(in--)
{
int tt, tit;
char pt, flag;
scanf("%d %c %d %c", &tt, &pt, &tit, &flag);
if(flag == '+')
{
if(wa[tt][pt-'A'] != -)
{
Time[tt] += (tit+(wa[tt][pt-'A']*));
P[tt]++;
wa[tt][pt-'A'] = -;
}
}
else
{
if(wa[tt][pt-'A'] != -)
wa[tt][pt-'A']++;
}
} int PM = ; //A题最多数
vector<TEAM> team_;
for(int j = ; j < K; j++)
{
int tj = team[j];
team_.push_back(TEAM(tj, P[tj], Time[tj]));
PM = max(PM, P[tj]);
}
sort(team_.begin(), team_.end());
int R; //排名
for(int j = ; j < K; j++)
{
int tj = team_[j].id;
if(j && team_[j].pro == team_[j-].pro && team_[j].Time == team_[j-].Time) ;
else R = j+;
if(PM != )
RS[tj] = (1.0*P[tj])/PM;
else
RS[tj] = 0.0;
S[tj] += (RS[tj]*A)/(R+B); //tj队累计得分
}
}
vector<Score> ans;
for(int j = ; j <= n; j++)
{
if(C[j] == ) T[j] = 0.0;
else T[j] = S[j]/C[j]; //第j队总得分
ans.push_back(Score(j, T[j]));
}
sort(ans.begin(), ans.end()); //总得分排序,输出
for(int i = ; i < ans.size(); i++)
{
cout << Name[ans[i].id];
for(int j = ; j < (maxl+)-Name[ans[i].id].length(); j++)
{
printf(" ");
}
printf("%.4lf\n", ans[i].s);
}
if(kk != Kase) printf("\n");
}
return ;
}

【模拟ACM排名】ZOJ-2593 Ranking (Andrew Stankevich’s Contest #5)的更多相关文章

  1. [Andrew Stankevich's Contest#21] Lempel-Ziv Compression

    Time Limit: 20000/10000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)     Special Judge ...

  2. Andrew Stankevich's Contest (21) J dp+组合数

    坑爹的,,组合数模板,,, 6132 njczy2010 1412 Accepted 5572 MS 50620 KB C++ 1844 B 2014-10-02 21:41:15 J - 2-3 T ...

  3. Andrew Stankevich&#39;s Contest (1)

    Andrew Stankevich's Contest (1) 打一半出门了,回来才补完了...各种大数又不能上java..也是蛋疼无比 A:依据置换循环节非常easy得出要gcd(x, n) = 1 ...

  4. acdream:Andrew Stankevich Contest 3:Two Cylinders:数值积分

    Two Cylinders Special JudgeTime Limit: 10000/5000MS (Java/Others)Memory Limit: 128000/64000KB (Java/ ...

  5. 2017 ACM - ICPC Asia Ho Chi Minh City Regional Contest

    2017 ACM - ICPC Asia Ho Chi Minh City Regional Contest A - Arranging Wine 题目描述:有\(R\)个红箱和\(W\)个白箱,将这 ...

  6. ACM题目————zoj问题

    题目1006:ZOJ问题 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:20322 解决:3560 题目描述: 对给定的字符串(只包含'z','o','j'三种字符),判断他是否能AC. ...

  7. 拓扑排序--P2881 [USACO07MAR]排名的牛Ranking the Cows

    *传送 FJ想按照奶牛产奶的能力给她们排序.现在已知有N头奶牛(1 ≤ N ≤ 1,000).FJ通过比较,已经知道了M(1 ≤ M ≤ 10,000)对相对关系.每一对关系表示为“X Y”,意指X的 ...

  8. Linux下使用USB模拟ACM串口设备

    这个想法之前就在脑袋里有过,最近公司产品要用到,所以多做了些了解. 1. USB 简介 USB 是 Universal Serial Bus 的缩写,从字面上看,就是通用串行总线的意思.从物理上看,其 ...

  9. [ACM_模拟] ACM - Draw Something Cheat [n个长12的大写字母串,找出交集,按字母序输出]

    Description Have you played Draw Something? It's currently one of the hottest social drawing games o ...

随机推荐

  1. rsync 无密码传输文件

    最近机器迁移,需要备份文件,但各个机器间不能穿梭,即无法通过scp来传输文件, 在运维的建议下,选用了rsync作为传输的工具. 默认情况Ubuntu安装了rsync服务,但在/etc下没有配置文件, ...

  2. Android程序的安全系统【转】

    最近在移植Android过程中遇到了Android程序(apk)权限的问题.最近也对这方面进行了一些了解,在此和大家分享. Android框架是基于Linux内核构建,所以Android安全系统也是基 ...

  3. internet访问局域网内部方法之----------路由器端口映射

    很多人每天都问为什么要端口映射?例如:通过路由器上网的,网站自己可以访问,但是别人就不能:输入127.0.0.1可以访问,别人还是看不到:输入localhost可以看到,但是别人就是看不到,气人啊-没 ...

  4. 怎样提交FIREDAC数据集的DELTA到中间件然后保存进数据库

    你可以在客户端序列FireDAC数据集的DELTA , 将序列后的STREAM发送给中间件, 中间件的TFDQuery或TFDMemTable调用LOADFROMSTREAM()方法加载流, 然后调用 ...

  5. OAuth2-Server-php

    Yii 有很多 extension 可以使用,在查看了 Yii 官网上提供的与 OAuth 相关的扩展后,发现了几个 OAuth2 的客户端扩展,但是并没有找到可以作为 OAuth2 Server 的 ...

  6. Spring Data JPA Tutorial Part Nine: Conclusions(未翻译)

    This is the ninth and the last part of my Spring Data JPA tutorial. Now it is time to take a look of ...

  7. ecshop以幻灯版调用首页主广告显示

    默认的是index_ad.lbi模板有一个$flash变量了,但在搜索搜索没发现 <!--{foreach from=$flash name=no item=flash}--> <l ...

  8. Windows 环境下于虚拟环境安装源码安装 cx_oracle

    安装前提条件: (1).安装 instantclient-basic-nt (2).安装 instantclient-sdk-nt (3).安装 Microsoft Visual C++ Compil ...

  9. javascript --执行上下文,作用域

    执行上下文 顾名思意就知道他是动态的,只在代码运行的时候产生 作用域 顾名思意就知道它是一个"领域",并且这个"领域"在一开始就规划好, 不会在改, var d ...

  10. 关于Struts2的客户端校验的FreeMarker template error!

    把<s:form action="login" namespace="/" validate="true" >改为 <s: ...