Advertisement
Guest User

45

a guest
Sep 18th, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp2
  8. {
  9.     class Program
  10.     {
  11.         static long T = 3;
  12.         static long P = 5;
  13.         static long H = 6;
  14.         static long Tn = 3;
  15.         static long Pn = 7;
  16.         static long Hn = 9;
  17.         static void Main(string[] args)
  18.         {
  19.             int nums = 0;
  20.             while (nums <= 1)
  21.             {
  22.                 if (T <= P && T <= H)
  23.                 {
  24.                     T += Tn;
  25.                     Tn += 1;
  26.                 }
  27.                 else if (P <= T && P <= H)
  28.                 {
  29.                     P += Pn;
  30.                     Pn += 3;
  31.                 }
  32.                 else if (H <= T && H <= P)
  33.                 {
  34.                     H += Hn;
  35.                     Hn += 4;
  36.                 }
  37.                 if ((T == P) && (T == H))
  38.                     nums++;
  39.             }
  40.             Console.WriteLine(T);
  41.             Console.ReadKey();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement