import java.util.*;
class Time{
int h;
int m;
int s;
public Time(int h,int m,int s) {
if(h<=0||h>12)
h=12;
this.h=h;
if(m<0||m>59)
m=0;
this.m=m;
if(s<0||s>59)
s=0;
this.s=s;
}
}
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int M=sc.nextInt();
int S=sc.nextInt();
Time time=new Time(H,M,S);
System.out.printf("%02d:%02d:%02d\n",time.h,time.m,time.s);
sc.close();
}
}
Time类定义
最新推荐文章于 2024-01-24 14:59:45 发布