1 using System;
 2 
 3 using System.Collections.Generic;
 4 
 5 using System.Text;
 6 
 7 namespace FindTheNumber
 8 
 9 {
10   class Program
11   {
12     static void Main(string[] args)
13     {
14       int [] rg =
15           {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
16            20,21,22,23,24,25,26,27,28,29,30,31};
17       for (Int64 i = 1; i < Int64.MaxValue; i++)
18       {
19         int hit = 0;
20         int hit1 = -1;
21         int hit2 = -1;
22         for (int j = 0; (j < rg.Length) && (hit <=2) ; j++)
23         {
24           if ((i % rg[j]) != 0)
25           {
26             hit++;
27             if (hit == 1)
28             {
29               hit1 = j;
30             }
31             else if (hit == 2)
32             {
33               hit2 = j;
34             }
35             else
36               break;
37           }
38 
39         }
40         if ((hit == 2)&& (hit1+1==hit2))
41         {
42           Console.WriteLine("found {0}", i);
43         }
44       }
45     }
46   }
47 }
View Code

相关文章:

  • 2021-06-23
  • 2021-07-12
  • 2021-12-18
  • 2022-03-03
  • 2021-07-05
  • 2021-11-14
  • 2021-05-16
  • 2022-12-23
猜你喜欢
  • 2022-01-31
  • 2021-06-02
  • 2021-11-20
相关资源
相似解决方案