网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

本吧头图、背景、导航顶部以及页面右侧信息由第三方提供,可能存在广告,请您仔细甄别。
之星交流吧
关注:3,934贴子:56,394
 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
08月31日漏签0天

百度之星大赛官方贴吧 官方邮箱:astar@baidu.com

了解更多关于之星交流>>

  • 2019百度之星Astar2019百度之星Astar
  • 2018百度之星Astar2018百度之星Astar
  • 2017百度之星Astar2017百度之星Astar
  • 2016百度之星Astar2016百度之星Astar
  • 看贴
  • 图片
    0
  • 视频
    0
  • 精品
    0
  • 1回复贴,共1页
<<返回之星交流吧
>0< 加载中...

吃空格很不好啊……

  • 只看楼主
  • 收藏

  • 回复
  • alcyl
  • 星途起步
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
(*
* 2011-06-09 Martin <Martin@Martin-desktop>
*
*)
Program Elo;
Uses
Math;
Const
MaxiN = 9999;
Type
TIndex = Longint;
TMain = Extended;
TFlag = Boolean;
Procedure Swap(Var i, j: TIndex);
Var
Tmp: TIndex;
Begin
Tmp := i;
i := j;
j := Tmp;
End;
Procedure Swap(Var i, j: String);
Var
Tmp: String;
Begin
Tmp := i;
i := j;
j := Tmp;
End;
Function Sig(Const X: TMain): TIndex;
Begin
If abs(X) < 1e-9 then
Begin
Sig := 0;
Exit;
End;
If X < 0 then
Sig := - 1
Else
Sig := 1;
End;
Procedure Solve(Const Id: TIndex);
Const
Tab = Chr(9);
Var
N, M, i, j, Tot, RatedPlayer: TIndex;
Ex, EA, SA, Delta, Average: TMain;
Flag: TFlag;
InFile, OutFile, TestFile: String;
F1, F2, F3: Text;
Ch: Char;
Name, Player: Array[1..MaxiN] of String;
Event, Rating, Number, Diff: Array[1..MaxiN] of TIndex;
Score: Array[1..MaxiN] of TMain;
Function getHash(Const St: String): TIndex;
Var
i: TIndex;
Begin
For i := 1 to Tot do
If St = Name[i] then
Begin
getHash := i;
Exit;
End;
Inc(Tot);
Name[Tot] := St;
Event[Tot] := 0;
Rating[Tot] := 0;
getHash := Tot;
End;
Begin
Str(Id - 1, InFile);
InFile := InFile + '.out';
Assign(F1, InFile);
Reset(F1);
N := 0;
While Not SeekEof(F1) do
Begin
Inc(N);
Name[N] := '';
Read(F1, Ch);
While Not (Ch = ' ') do
Begin
Name[N] := Name[N] + Ch;
Read(F1, Ch);
End;
Readln(F1, Event[N], Rating[N]);
End;
Close(F1);
Str(Id, TestFile);
TestFile := TestFile + '.in';
Assign(F3, TestFile);
Reset(F3);
M := 0;
While Not SeekEof(F3) do
Begin
Inc(M);
Player[M] := '';
Read(F3, Ch);
While (Ch <> ' ') and (Ch <> Tab) do
Begin
Player[M] := Player[M] + Ch;
Read(F3, Ch);
End;
Score[M] := 0;
Flag := False;
Ex := 0;
While Not Eoln(F3) do
Begin
Read(F3, Ch);
If (Ch = '.') or (Ch in ['0'..'9']) then
Begin
If (Ch in ['0'..'9']) then
Begin
If (Flag) then
Begin
Ex := Ex / 10.0;
Score[M] := Score[M] + Ex * (Ord(Ch) - Ord('0'));
End
Else
Score[M] := Score[M] * 10 + Ord(Ch) - Ord('0');
End
Else
Begin
Flag := True;
Ex := 1.0;
End;
End
Else
Begin
Score[M] := 0;
Flag := False;
End;
End;
Readln(F3);
End;
Close(F3);
Tot := N;
For i := 1 to M do
Number[i] := getHash(Player[i]);
RatedPlayer := 0;
For i := 1 to M do
If (Number[i] <= N) then
Inc(RatedPlayer);
If (RatedPlayer <= 1) then
Begin
For i := 1 to M do



  • alcyl
  • 星途起步
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
If (Number[i] > N) then
Rating[Number[i]] := 1200;
RatedPlayer := M;
N := Tot;
End;
If RatedPlayer >= 1 then
Begin
Average := 0;
For i := 1 to M do
If (Number[i] <= N) then
Average := Average + Rating[Number[i]];
Average := Average / RatedPlayer;
End;
For i := 1 to M do
Begin
If (Number[i] <= N) and (Rating[Number[i]] >= 500) then
Begin
Delta := 0;
For j := 1 to M do
if (Number[i] <> Number[j]) and (Number[j] <= N) then
Begin
EA := 1.0 / (1.0 + Exp(Ln(10.0) * (Rating[Number[j]] - Rating[Number[i]]) / 400.0));
SA := 0.5 * (1.0 + Sig(Score[i] - Score[j]));
Delta := Delta + SA - EA;
End;
If Event[Number[i]] < 30 then
Delta := Delta * 25.0
Else
Begin
If Rating[Number[i]] < 2400 then
Delta := Delta * 15.0
Else
Delta := Delta * 10.0;
End;
Diff[Number[i]] := Round(Delta);
End
Else
Begin
Delta := 0;
For j := 1 to M do
if (Number[i] <> Number[j]) then
Begin
Delta := Delta + 0.5 * (1.0 + Sig(Score[i] - Score[j]));
End;
Delta := Delta / M;
Delta := max(Delta, 0.00990099);
Delta := min(Delta, 0.99009901);
Diff[Number[i]] := Round(Average + 400.0 * (Ln(1.0 / (1.0 - Delta) - 1.0) / Ln(10.0)));
End;
End;
For i := 1 to M do
Begin
Inc(Rating[Number[i]], Diff[Number[i]]);
Rating[Number[i]] := max(Rating[Number[i]], 0);
Inc(Event[Number[i]]);
End;
N := Tot;
For i := 1 to N do
For j := i + 1 to N do
If (Rating[i] < Rating[j]) then
Begin
Swap(Name[i], Name[j]);
Swap(Rating[i], Rating[j]);
Swap(Event[i], Event[j]);
End;
Str(Id, OutFile);
OutFile := OutFile + '.out';
Assign(F2, OutFile);
Rewrite(F2);
For i := 1 to N do
Writeln(F2, Name[i], ' ', Event[i], ' ', Rating[i]);
Close(F2);
End;
Procedure Main;
Var
i: TIndex;
Begin
For i := 1001 to 1081 do
Solve(i);
End;
Begin
Main;
End.



登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1回复贴,共1页
<<返回之星交流吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示