标签:bre else char string ++ res bool ack package
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); String str1 = sc.nextLine(); String str2 = sc.nextLine(); String str3 = sc.nextLine(); String str4 = sc.nextLine(); char[] char1 = str1.toCharArray(); char[] char2 = str2.toCharArray(); char[] char3 = str3.toCharArray(); char[] char4 = str4.toCharArray(); char[] result1 = new char[2]; String[][] week = {{"A", "MON"}, {"B", "TUE"}, {"C", "WED"}, {"D", "THU"}, {"E", "FRI"}, {"F", "STA"}, {"G", "SUN"}}; int[] hour = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78}; int result2 = 0; int n = 0; boolean b=false; for (int i = 0; i < char1.length; i++) { if (char1[i] == char2[i]) { if (char1[i] >= 65 && char1[i] <= 90) { result1[0] = char1[i]; b=true; } if(b){ if ((char1[i] >= 65 && char1[i] <= 78) || (char1[i] >= 48 && char1[i] <= 57)) { result1[1] = char1[i]; break; } } } } for (int i = 0; i < char3.length; i++) { for (int j = 0; j < char4.length; j++) { if (char3[i] == char4[i] && char3[i] == 115) { result2 = i; } } } for (int i = 0; i < 7; i++) { if (week[i][0].equals(result1[0]+"")) { System.out.print(week[i][1] + " "); } } for (int j = 0; j < 24; j++) { if (hour[j] == result1[1]) {//hour是int类型,result1[2]是字符型 System.out.print(j+1 + ":"); } } if(result2>9){ System.out.print(result2); }else{ System.out.print("0"+result2); } } }
标签:bre else char string ++ res bool ack package
原文地址:https://www.cnblogs.com/zhuzehua/p/9727031.html