-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDayOfProgrammer.java
More file actions
57 lines (51 loc) · 1.51 KB
/
DayOfProgrammer.java
File metadata and controls
57 lines (51 loc) · 1.51 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
static String solve(int year){
// Complete this function
String leap = "12.09.";
String nleap = "13.09.";
String result;
if(year>1918){
if((year%400)==0||((year%4==0)&&(year%100)!=0)){
result = new String(leap);
result = result.concat(Integer.toString(year));
return result;
}
else {
result = new String(nleap);
result = result.concat(Integer.toString(year));
return result;
}
}
else if(year<1918){
if(year%4==0){
result = new String(leap);
result = result.concat(Integer.toString(year));
return result;
}
else {
result = new String(nleap);
result = result.concat(Integer.toString(year));
return result;
}
}
else if(year==1918){
result = new String("26.09.");
result = result.concat(Integer.toString(year));
return result;
}
else {
return "0";
}
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int year = in.nextInt();
String result = solve(year);
System.out.println(result);
}
}