Guest User

Untitled

a guest
Jan 24th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. 4396 / 157 = 28
  2. 5346 / 198 = 27
  3. 5346 / 297 = 18
  4. 5796 / 138 = 42
  5. 5796 / 483 = 12
  6. 7254 / 186 = 39
  7. 7632 / 159 = 48
  8.  
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14.  
  15. namespace ConsoleApp16
  16. {
  17. class Program
  18. {
  19. static void Main(string[] args)
  20. {
  21. int r = 0;
  22. for(int i = 1000; i < 9999; i++)
  23. {
  24. for(int j = 111; j < 999; j++)
  25. {
  26. if(i % j == 0)
  27. {
  28. int k = i / j;
  29. if((k > 9) & (k < 100) & (Func1(i, j, k)))
  30. {
  31. Console.WriteLine(i + " / " + j + " = " + k);
  32. r++;
  33. }
  34. }
  35. }
  36. }
  37. Console.Read();
  38.  
  39. Console.WriteLine("sum = " + r);
  40. }
  41. protected static bool Func1(int i, int j, int k)
  42. {
  43. int[] array = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  44. bool Func1 = false;
  45.  
  46. while (i != 0)
  47. {
  48. if (array[i % 10] > 0)
  49. {
  50. break;
  51. }
  52. i += array[i % 10];
  53. i /= 10;
  54. }
  55.  
  56. while (j != 0)
  57. {
  58. if (array[j % 10] > 0)
  59. {
  60. break;
  61. }
  62. j += array[j % 10];
  63. j /= 10;
  64. }
  65.  
  66. while (k != 0)
  67. {
  68. if (array[k % 10] > 0)
  69. {
  70. break;
  71. }
  72. k += array[k % 10];
  73. k /= 10;
  74. }
  75. Func1 = true;
  76. return Func1;
  77. }
  78. }
  79. }
  80.  
  81. int[] array = new int[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  82.  
  83. while (i != 0)
  84. {
  85. if (array[i % 10] > 0)
  86. return false;
  87. array[i % 10] += 1;
  88. i /= 10;
  89. }
Add Comment
Please, Sign In to add comment