Advertisement
Guest User

4. Persian rugs

a guest
Feb 4th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  8.  
  9. class Program
  10. {
  11. static void Main()
  12. {
  13. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  14.  
  15. int n = int.Parse(Console.ReadLine());
  16. int k = int.Parse(Console.ReadLine());
  17.  
  18. int width = 2*n + 1;
  19.  
  20. for (int i = 0; i < n; i++)
  21. {
  22. Console.Write(new string('#', i));
  23. Console.Write("\\");
  24. if (width > 2 * i + 2 * k + 4)
  25. {
  26. Console.Write(new string(' ', k));
  27. Console.Write("\\");
  28. Console.Write(new string('.', width - 2*k - 4 - 2*i));
  29. Console.Write("/");
  30. Console.Write(new string(' ', k));
  31. }
  32. else
  33. {
  34. Console.Write(new string(' ', width - 2 - 2*i));
  35. }
  36. Console.Write("/");
  37. Console.WriteLine(new string('#', i));
  38. }
  39. Console.Write(new string('#', n));
  40. Console.Write("X");
  41. Console.WriteLine(new string('#', n));
  42. for (int i = n - 1; i >= 0; i--)
  43. {
  44. Console.Write(new string('#', i));
  45. Console.Write("/");
  46. if (width > 2 * i + 2 * k + 4)
  47. {
  48. Console.Write(new string(' ', k));
  49. Console.Write("/");
  50. Console.Write(new string('.', width - 2 * k - 4 - 2 * i));
  51. Console.Write("\\");
  52. Console.Write(new string(' ', k));
  53. }
  54. else
  55. {
  56. Console.Write(new string(' ', width - 2 - 2 * i));
  57. }
  58. Console.Write("\\");
  59. Console.WriteLine(new string('#', i));
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement