GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — :tada: feat: initial commit for 1014 using java · liuchuo/PAT@416a2b5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • BasicLevel_Java
    • 1014. 福尔摩斯的约会 (20).java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎BasicLevel_Java/1014. 福尔摩斯的约会 (20).java‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import java.util.Scanner;
2+
3+
public class Main {
4+
final static String[] week = new String[]{"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
5+
6+
public static void main(String[] args) {
7+
Scanner in = new Scanner(System.in);
8+
String str1 = in.nextLine();
9+
String str2 = in.nextLine();
10+
String str3 = in.nextLine();
11+
String str4 = in.nextLine();
12+
char a1 = ' ', a2 = ' ';
13+
int a3 = -1;
14+
boolean a11 = true;
15+
int i;
16+
char[] c1 = str1.toCharArray();
17+
char[] c2 = str2.toCharArray();
18+
char[] c3 = str3.toCharArray();
19+
char[] c4 = str4.toCharArray();
20+
for (i = 0; i < (c1.length > c2.length ? c2.length : c1.length); i++) {
21+
if (c1[i] == c2[i] && a11 && c1[i] >= 'A' && c1[i] <= 'G') {
22+
a1 = c1[i];
23+
a11 = false;
24+
i++;
25+
}
26+
if (!a11 && c1[i] == c2[i] && (c1[i] >= 'A' && c1[i] <= 'N' || c1[i] >= '0' && c1[i] <= '9')) {
27+
a2 = c1[i];
28+
break;
29+
}
30+
}
31+
for (i = 0; i < (c3.length > c4.length ? c4.length : c3.length); i++) {
32+
if (c3[i] == c4[i] && c3[i] >= 'A' && c3[i] <= 'z') {
33+
a3 = i;
34+
break;
35+
}
36+
}
37+
System.out.print(week[a1 - 65] + " " + (a2 > '9' ? (a2 - 55) : ("0" + a2)) + ":" + (a3 > 9 ? a3 : ("0" + a3)));
38+
}
39+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.