Advertisement
minusa71

gags

Feb 12th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1.  
  2. using System;
  3.  
  4. using System.Collections.Generic;
  5.  
  6. using System.Linq;
  7.  
  8. using System.Text;
  9.  
  10.  
  11. namespace _9GagNumbers
  12.  
  13. {
  14.  
  15. class Program
  16.  
  17. {
  18.  
  19. static void Main(string[] args)
  20.  
  21. {
  22.  
  23. string gagnumber = Console.ReadLine();
  24.  
  25. string[] gags = { "-!", "**", "!!!", "&&", "&-", "!-", "*!!!", "&*!", "!!**!-" };
  26.  
  27. List<int> numbers = new List<int>();
  28.  
  29. List<int> results = new List<int>();
  30.  
  31. int count = 0;
  32.  
  33. int result = 0;
  34.  
  35. for (int i = 0; i < gags.Length; i++)
  36.  
  37. {
  38.  
  39. if (gags[i] == gagnumber)
  40.  
  41. {
  42.  
  43. Console.WriteLine(i);
  44.  
  45. break;
  46.  
  47. }
  48.  
  49. else
  50.  
  51. {
  52.  
  53. if (i==gags.Length-1)
  54.  
  55. {
  56.  
  57.  
  58. for (int k = 0; k <= gagnumber.Length - 1; k++)
  59.  
  60. {
  61.  
  62. for (int l = 1; l < gagnumber.Length - k + 1; l++)
  63.  
  64. {
  65.  
  66. for (int j = 0; j < gags.Length; j++)
  67.  
  68. {
  69.  
  70. if (gagnumber.Substring(k, l) == gags[j])
  71.  
  72. {
  73.  
  74. results.Add(j);
  75.  
  76. k =k+gags[j].Length;
  77.  
  78. l = 1;
  79.  
  80.  
  81.  
  82. break;
  83.  
  84. }
  85.  
  86. }
  87.  
  88. }
  89.  
  90. }
  91.  
  92.  
  93.  
  94. results.Reverse();
  95.  
  96. for (int j=0; j <results.Count;j++)
  97.  
  98. {
  99.  
  100. result +=(results[j])*(int)Math.Pow(9,j);
  101.  
  102. }
  103.  
  104. Console.WriteLine(result);
  105.  
  106.  
  107.  
  108. }
  109.  
  110. }
  111.  
  112.  
  113.  
  114. }
  115.  
  116.  
  117.  
  118. }
  119.  
  120.  
  121.  
  122. }
  123.  
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement