Beispiel #1
0
 public void Push(Sushi param)
 {
     if (netalist[param.neta] == 0)
     {
         neta++;
     }
     netalist[param.neta]++;
     oishisa         += param.oishisa;
     param.isIncluded = true;
     slist.Push(param);
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            var V      = ReadLongs();
            int N      = (int)V[0];
            var sushis = new Sushi[N];

            for (int i = 0; i < N; ++i)
            {
                sushis[i] = new Sushi(ReadLongs());
            }
            Console.WriteLine(Solve(N, V[1], sushis));
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            int[] V = ReadInts();
            int   N = V[0], K = V[1];
            var   sushis = new Sushi[N];

            for (int i = 0; i < N; ++i)
            {
                sushis[i] = new Sushi(ReadLongs());
            }
            Console.WriteLine(Solve(N, K, sushis));
        }
Beispiel #4
0
        private bool RemoveMinNeta(List <Sushi> param)
        {
            bool flag = false;
            int  size = slist.Size;

            for (int i = 0; i < size; i++)
            {
                Sushi s = slist.Pop();
                if (netalist[s.neta] > 1)
                {
                    netalist[s.neta]--;
                    oishisa     -= s.oishisa;
                    s.isIncluded = false;
                    flag         = true;
                    break;
                }
            }

            return(flag);
        }