为什么我输出和预期输出一样,但是不通过啊😥
import java.nio.Buffer;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String temp;
for (int i = 0; i != n; i++) {
temp = sc.next();
StringBuffer buffer = new StringBuffer(temp);
if (buffer.charAt(0) > '2' || (buffer.charAt(0) == '2' && temp.charAt(1) >= '5')) {
buffer.setCharAt(0, '0');
}
if (buffer.charAt(3) > '6' || (buffer.charAt(3) == '6' && temp.charAt(4) != '0')) {
buffer.setCharAt(3, '0');
}
if (buffer.charAt(6) > '6' || (buffer.charAt(6) == '6' && temp.charAt(7) != '0')) {
buffer.setCharAt(6, '0');
}
String s = buffer.toString();
System.out.println(s);
}
}
}
import java.nio.Buffer;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String temp;
for (int i = 0; i != n; i++) {
temp = sc.next();
StringBuffer buffer = new StringBuffer(temp);
if (buffer.charAt(0) > '2' || (buffer.charAt(0) == '2' && temp.charAt(1) >= '5')) {
buffer.setCharAt(0, '0');
}
if (buffer.charAt(3) > '6' || (buffer.charAt(3) == '6' && temp.charAt(4) != '0')) {
buffer.setCharAt(3, '0');
}
if (buffer.charAt(6) > '6' || (buffer.charAt(6) == '6' && temp.charAt(7) != '0')) {
buffer.setCharAt(6, '0');
}
String s = buffer.toString();
System.out.println(s);
}
}
}
全部评论
相关推荐
点赞 评论 收藏
分享
2024-12-26 20:46
复旦大学 C++ 国棉17厂丶小王:拿了offer的那个周末晚上去网吧通宵,去网吧不知道玩什么刷了lc的每日一题,然后试着第一次打开了三角洲行动,从此少了一个已经刷了700道题的lc用户,但是烽火地带多了一只🐭🐭
点赞 评论 收藏
分享