Advertisement
RMarK0

Dasha #2

Feb 2nd, 2022
1,538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string[] a = Console.ReadLine().Split(' ');
  10.  
  11.             long start = long.Parse(a[0]);
  12.             long end = long.Parse(a[1]);
  13.  
  14.             int counter = 0;
  15.             for (int i = 1; i < 10; i++)
  16.             {
  17.                 int startPoint = i;
  18.                 long current = i;
  19.  
  20.                 for (long j = 0; j < 18; j++)
  21.                 {
  22.                     if ((current >= start) && (current <= end))
  23.                     {
  24.                         counter++;
  25.                         current = current * 10 + startPoint;
  26.                     }
  27.                     else
  28.                         break;
  29.                 }
  30.             }
  31.             Console.WriteLine(counter);
  32.             Console.ReadKey();
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement