Advertisement
AvengersAssemble

LotsaShit

Jan 29th, 2014
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 KB | None | 0 0
  1.  class Program
  2.     {
  3.         static void Main() //2003 ex 9
  4.         {
  5.             int[,] arr = new int[18, 25];
  6.             string smallLoc = "0,0";
  7.             for (int i = 0; i < arr.GetLength(0); i++)
  8.             {
  9.                 for (int j = 0; j < arr.GetLength(1); j++)
  10.                     arr[i, j] += int.Parse(Console.ReadLine());
  11.             }
  12.             for (int i = 0; i < arr.GetLength(0); i++)
  13.             {
  14.                 for (int j = 0; j < arr.GetLength(1); j++)
  15.                     if (arr[i, j] < arr[int.Parse(smallLoc.Substring(0, smallLoc.IndexOf(','))), int.Parse(smallLoc.Substring(smallLoc.IndexOf(',')))])
  16.                         smallLoc = i + "," + j;
  17.             }
  18.         }
  19.         static void Main() //2003 ex 8
  20.         {
  21.             string st, newSt = "";
  22.             st = Console.ReadLine();
  23.             st = st.Replace(" ", "");
  24.             Console.WriteLine(st);
  25.             for (int i = 0; i < st.Length; i++)
  26.             {
  27.                 newSt += st[i];
  28.                 if (st[i] < 'M')
  29.                     newSt += (char)((int)st[i] + 1);
  30.                 else
  31.                     newSt += (char)((int)st[i] - 1);
  32.             }
  33.             Console.WriteLine("Encrypted: " + newSt);
  34.         }
  35.         public static bool Increasing(int[,] arr) //1997 ex. 10
  36.         {
  37.             int currentSum = 0, lastSum = 0;
  38.             for (int i = 0; i < arr.GetLength(0); i++)
  39.             {
  40.                 for (int j = 0; j < arr.GetLength(1); j++)
  41.                     currentSum += arr[i, j];
  42.                 Console.WriteLine("Current sum: " + currentSum);
  43.                 if (currentSum < lastSum)
  44.                     return false;
  45.                 lastSum = currentSum;
  46.                 currentSum = 0;
  47.             }
  48.             return true;
  49.         }
  50.         static void Main() //1997 ex. 10
  51.         {
  52.             int[,] arr = new int[10, 20];
  53.             for (int i = 0; i < arr.GetLength(0); i++)
  54.             {
  55.                 for (int j = 0; j < arr.GetLength(1); j++)
  56.                     arr[i, j] = int.Parse(Console.ReadLine());
  57.             }
  58.             Console.WriteLine(Increasing(arr));
  59.         }
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement