-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (28 loc) · 891 Bytes
/
Program.cs
File metadata and controls
38 lines (28 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
namespace Beautiful_Days_at_the_Movies {
class Program {
public static int Reverse(int i) {
int reverse = 0;
while (i > 0) {
reverse = (reverse * 10) + (i % 10);
i = i / 10;
}
return reverse;
}
public static int BeautifulDays(int i, int j, int k) {
int count = 0;
for (; i <= j; i++) {
if ((i - Reverse(i)) % k == 0) count++;
}
return count;
}
static void Main(string[] args) {
string[] ijk = Console.ReadLine().Split(' ');
int i = Convert.ToInt32(ijk[0]);
int j = Convert.ToInt32(ijk[1]);
int k = Convert.ToInt32(ijk[2]);
int result = BeautifulDays(i, j, k);
Console.WriteLine(result);
}
}
}