示例#1
0
        public Standing(Entity.User user, Entity.Contest contest)
        {
            UserID  = user.ID;
            Details = new List <StandingCol>();
            var problems = contest.Problems.OrderBy(x => x.Credit);

            foreach (var problem in problems)
            {
                Details.Add(new StandingCol(user, problem));
            }
            Key1     = Details.Sum(x => x.Key1);
            Key2     = Details.Sum(x => x.Key2);
            Key3     = Details.Sum(x => x.Key3);
            Gravatar = Helpers.Gravatar.GetAvatarURL(user.Gravatar, 180);
            Nickname = Helpers.ColorName.GetNicknameHtml(user.Nickname, user.Ratings.Sum(x => x.Credit) + 1500);
            UserID   = user.ID;
            Display1 = Key1.ToString();
            switch (contest.Format)
            {
            case Entity.ContestFormat.OI:
                Display2 = Key2 + " ms";
                break;

            case Entity.ContestFormat.OPJOI:
                Display2 = Key2.ToString();
                break;

            case Entity.ContestFormat.ACM:
                Display2 = new TimeSpan(0, 0, Key2).ToString("c");
                break;

            case Entity.ContestFormat.Codeforces:
            case Entity.ContestFormat.TopCoder:
                if (Key2 == 0 && Key3 == 0)
                {
                    Display2 = "";
                }
                else if (Key2 != 0 && Key3 == 0)
                {
                    Display2 = "+" + Key2;
                }
                else if (Key2 == 0 && Key3 != 0)
                {
                    Display2 = "-" + Key3;
                }
                else
                {
                    Display2 = "+" + Key2 + " : -" + Key3;
                }
                Key1    += Key2 * 100;
                Key1    -= Key3 * 50;
                Display1 = Key1.ToString();
                break;
            }
        }
        public override string ToString()
        {
            var s = new System.Text.StringBuilder("");

            s.Append('[');
            if (Key1 != null)
            {
                s.Append(Key1.ToString());
            }
            s.Append(", ");
            if (Key2 != null)
            {
                s.Append(Key2.ToString());
            }
            s.Append(", ");
            if (Value != null)
            {
                s.Append(Value.ToString());
            }
            s.Append(']');
            return(s.ToString());
        }
 public override string ToString()
 {
     return(Key1.ToString() + " - " + Key2.ToString() + " - " + Value.ToString());
 }
示例#4
0
 public override string ToString()
 {
     return(firstKey.ToString() + secondKey.ToString());
 }