Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.74 KB | None | 0 0
  1. internal class Solution
  2. {
  3.     private static void Main(String[] args)
  4.     {
  5.         // cirlcular string of length N
  6.         var n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
  7.         var k = Console.ReadLine();
  8.         var integers = new List<int>();
  9.         var d = (int)Math.Round((decimal)k.Length/n[1]);
  10.         for (int i = 0; i < k.Length; i=i+d)
  11.        {
  12.            if (i < k.Length - d) {
  13.                var s = k.Substring(i, d);
  14.                integers.Add(int.Parse(s));
  15.            }
  16.            else
  17.            {
  18.                var s = k.Substring(i);
  19.                integers[0] = int.Parse(s + integers[0].ToString());
  20.            }
  21.        }
  22.        Console.WriteLine(integers.Max(p => p));
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement