示例#1
0
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var ps = Array.ConvertAll(new bool[n], _ => IntV.Parse(Console.ReadLine()));

        var gs = ps.GroupBy(p => p.X).OrderBy(g => g.Key).Select(g => g.OrderBy(p => p.Y).ToArray()).ToArray();

        var ps_u = GetUpper();
        var ps_l = GetLower();

        var area2 = GetArea2(ps_u) - GetArea2(ps_l);

        var lattices = 0L;

        lattices += gs[0][^ 1].Y - gs[0][0].Y;
示例#2
0
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var ps = Array.ConvertAll(new bool[n], _ => IntV.Parse(Console.ReadLine()));

        var  r  = 0;
        IntV tp = (1L, 0L);

        foreach (var p in ps.OrderBy(p => p - IntV.UnitX))
        {
            if (tp.CompareTo(p - IntV.UnitY) <= 0)
            {
                r++;
                tp = p - IntV.UnitX;
            }
        }

        return(r);
    }
示例#3
0
    static void Main()
    {
        var(r, n) = Read2();
        var ps = Array.ConvertAll(new bool[n], _ => Read3());

        var M  = 0;
        var dp = new List <(int t, IntV p, int c, int M)> {
            (0, new IntV(1, 1), 0, 0)
        };

        foreach (var(t, x, y) in ps)
        {
            var p = new IntV(x, y);
            var c = 0;

            for (int i = dp.Count - 1; i >= 0; i--)
            {
                var(t0, p0, c0, M0) = dp[i];
                if (t - t0 > r << 1)
                {
                    c = Math.Max(c, M0 + 1);
                    break;
                }
                if (t - t0 < (p - p0).NormL1)
                {
                    continue;
                }

                c = Math.Max(c, c0 + 1);
            }
            if (c > 0)
            {
                M = Math.Max(M, c);
                dp.Add((t, p, c, M));
            }
        }
        Console.WriteLine(M);
    }
示例#4
0
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var ps = Array.ConvertAll(new bool[n], _ => IntV.Parse(Console.ReadLine()));

        var r = 0;

        for (int i = 0; i < n; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                for (int k = j + 1; k < n; k++)
                {
                    var v1 = ps[i] - ps[j];
                    var v2 = ps[i] - ps[k];
                    if (!IntV.IsParallel(v1, v2))
                    {
                        r++;
                    }
                }
            }
        }
        return(r);
    }
示例#5
0
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        var c = NewArray2(n, n, '.');

        IntV p = (0, -1);
        IntV v = (0, 1);

        for (int k = n - 1; k > 0; k--)
        {
            for (int i = 0; i < k; i++)
            {
                p          += v;
                c[p.X][p.Y] = '#';
            }
            v = v.Rotate270();
        }

        foreach (var r in c)
        {
            Console.WriteLine(string.Join("", r));
        }
    }
示例#6
0
        private string GetTextDisplay()
        {
            try
            {
                string text = null;
                if (IntV > 0 || StringValue.HasValue())
                {
                    switch (SearchType)
                    {
                    case eSearchType.None:
                        break;

                    case eSearchType.User:
                        var obj101 = vmMas.GetUser(StringValue);
                        text             = obj101.FULLNAME_TH;
                        this.selectedrow = obj101;
                        break;

                    case eSearchType.Customer:
                        var obj201 = vmMas.GetCustomer(IntV.GetValueOrDefault());
                        text             = obj201.NAME;
                        this.selectedrow = obj201;
                        break;

                    case eSearchType.Project:
                        var obj202 = vmMas.GetCustomerProject(IntV.GetValueOrDefault());
                        text             = obj202.NAME;
                        this.selectedrow = obj202;
                        break;

                    case eSearchType.Instrument:
                        var obj303 = vmMas.GetInstrument(IntV.GetValueOrDefault());
                        text             = obj303.NAME;
                        this.selectedrow = obj303;
                        break;

                    case eSearchType.MethodAnalysis:
                        this.selectedrow = vmMas.GetMethodAnalysis(IntV.GetValueOrDefault());
                        text             = (this.selectedrow as sp_MAS304_GetMethodAnalysis_Result).NAME;
                        break;

                    case eSearchType.ParameterAnalysis:
                        this.selectedrow = vmMas.GetParameterAnalysis(IntV.GetValueOrDefault());
                        text             = (this.selectedrow as sp_MAS305_GetParameterAnalysis_Result).NAME;
                        break;

                    case eSearchType.ToolPick:
                        var obj308 = vmMas.GetToolPick(IntV.GetValueOrDefault());
                        text             = obj308.NAME;
                        this.selectedrow = obj308;
                        break;

                    case eSearchType.ToolAnalysis:
                        var obj309 = vmMas.GetToolAnalysis(IntV.GetValueOrDefault());
                        text             = obj309.NAME;
                        this.selectedrow = obj309;
                        break;

                    case eSearchType.StandardLight:
                        var obj302 = vmMas.GetSTDLight(IntV.GetValueOrDefault());
                        text             = obj302.ALIAS_NAME.GetValueOrDefault(obj302.NAME);
                        this.selectedrow = obj302;
                        break;
                    }
                }
                return(text);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }