Rezultati

Up. imeNalogaJezikRezultatČas oddaje
DROPTABLE-2017 Pakiranje piva C# 100/100OK 20. apr '17 @ 20:12

Test Točke Porabljen spomin Porabljen čas Status
#1 3/3 18,430 MiB 0,000 s OK
#2 3/3 18,402 MiB 0,000 s OK
#3 3/3 20,391 MiB 0,000 s OK
#4 3/3 20,395 MiB 0,000 s OK
#5 3/3 20,469 MiB 0,000 s OK
#6 3/3 18,453 MiB 0,000 s OK
#7 3/3 18,445 MiB 0,000 s OK
#8 3/3 18,461 MiB 0,000 s OK
#9 3/3 20,219 MiB 0,000 s OK
#10 3/3 20,434 MiB 0,000 s OK
#11 3/3 18,398 MiB 0,000 s OK
#12 3/3 20,395 MiB 0,000 s OK
#13 3/3 20,438 MiB 0,000 s OK
#14 3/3 20,457 MiB 0,000 s OK
#15 3/3 18,445 MiB 0,000 s OK
#16 3/3 20,387 MiB 0,000 s OK
#17 3/3 20,402 MiB 0,000 s OK
#18 3/3 20,297 MiB 0,000 s OK
#19 3/3 20,215 MiB 0,000 s OK
#20 3/3 20,355 MiB 0,000 s OK
#21 3/3 20,230 MiB 0,000 s OK
#22 3/3 20,430 MiB 0,000 s OK
#23 3/3 18,434 MiB 0,000 s OK
#24 3/3 20,398 MiB 0,000 s OK
#25 4/4 18,402 MiB 0,000 s OK
#26 4/4 18,309 MiB 0,000 s OK
#27 4/4 18,441 MiB 0,000 s OK
#28 4/4 20,395 MiB 0,000 s OK
#29 4/4 18,438 MiB 0,000 s OK
#30 4/4 14,527 MiB 0,000 s OK
#31 4/4 18,383 MiB 0,000 s OK

Ocenjevani program (PakiranjePiva2.cs):
// HULA HULA HOP reads from a file rather than stdin xD
// #define HULAHOP

using System;
using System.Collections.Generic;
using System.IO;


namespace csharp_template {
  class Program {

#if HULAHOP
    static string[] FILE_CONTENTS = File.ReadAllLines("tmp");
    static int FILE_LINE_CNT = 0;
#endif
    static string GetLine() {
#if HULAHOP
      return FILE_CONTENTS[FILE_LINE_CNT++];
#else
      return Console.ReadLine();
#endif
    }


    static int[] nums;


    static bool CheckK(int k) {
      foreach (var num in nums) {
        if (!IsValid(k, num)) return false;
      }
      Console.WriteLine(k);
      Environment.Exit(0);
      return true;
    }


    static bool IsValid(int k, int a) {
      return (k - 1) * Math.Ceiling((double)a / k) <= a;
    }


    static void Main(string[] args) {
      int count = int.Parse(GetLine());
      nums = new int[count];
      int min = Int32.MaxValue;
      for (int i = 0; i < count; i++) {
        nums[i] = int.Parse(GetLine());
        min = Math.Min(nums[i], min);
      }
      CheckK(min + 1);
      CheckK(min);
      int last = 5;
      for (int i = 2; ; i++) {
        bool jeCelStevilsko = min % i == 0;
        int res = (int)Math.Ceiling(min / (double)i);
        if (jeCelStevilsko)
          CheckK(res + 1);
        if (res < 5) {
          last = res;
          break;
        }
        CheckK(res);
      }
      for (int i = last; i > 1; i--) {
        CheckK(i);
      }
      Console.WriteLine(1);
    }


  }
}