1 時(shí)間換算(5分)
題目內(nèi)容:
UTC是世界協(xié)調(diào)時(shí)琉历,BJT是北京時(shí)間舞萄,UTC時(shí)間相當(dāng)于BJT減去8。現(xiàn)在誊稚,你的程序要讀入一個(gè)整數(shù)翔始,表示BJT的時(shí)和分。整數(shù)的個(gè)位和十位表示分里伯,百位和千位表示小時(shí)城瞎。如果小時(shí)小于10,則沒有千位部分疾瓮;如果小時(shí)是0脖镀,則沒有百位部分;如果分小于10分狼电,需要保留十位上的0蜒灰。如1124表示11點(diǎn)24分,而905表示9點(diǎn)5分肩碟,36表示0點(diǎn)36分强窖,7表示0點(diǎn)7分。
有效的輸入范圍是0到2359腾务,即你的程序不可能從測試服務(wù)器讀到0到2359以外的輸入數(shù)據(jù)毕骡。
你的程序要輸出這個(gè)時(shí)間對應(yīng)的UTC時(shí)間,輸出的格式和輸入的相同,即輸出一個(gè)整數(shù)未巫,表示UTC的時(shí)和分窿撬。整數(shù)的個(gè)位和十位表示分,百位和千位表示小時(shí)叙凡。如果小時(shí)小于10劈伴,則沒有千位部分;如果小時(shí)是0握爷,則沒有百位部分跛璧;如果分小于10分,需要保留十位上的0新啼。
提醒:要小心跨日的換算追城。
輸入格式:
一個(gè)整數(shù),表示BJT的時(shí)和分燥撞。整數(shù)的個(gè)位和十位表示分座柱,百位和千位表示小時(shí)。如果小時(shí)小于10物舒,則沒有千位部分色洞;如果小時(shí)是0,則沒有百位部分冠胯;如果小時(shí)不是0而且分小于10分火诸,需要保留十位上的0。
輸出格式:
一個(gè)整數(shù)荠察,表示UTC的時(shí)和分置蜀。整數(shù)的個(gè)位和十位表示分,百位和千位表示小時(shí)割粮。如果小時(shí)小于10盾碗,則沒有千位部分;如果小時(shí)是0舀瓢,則沒有百位部分廷雅;如果小時(shí)不是0而且分小于10分,需要保留十位上的0京髓。
輸入樣例:
933
輸出樣例:
133
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int BJT = 0;
int UTC = 0;
Scanner in = new Scanner(System.in);
BJT = in.nextInt();
if (BJT/10 == 0) {
UTC = 1600 + BJT;
System.out.println(UTC);
} else if (BJT/100 == 0) {
UTC = 1600 + BJT;
System.out.println(UTC);
} else if (BJT/1000 == 0) {
if (BJT >= 800) {
UTC = BJT - 800;
System.out.println(UTC);
}
else {
UTC = 2400 + BJT - 800;
System.out.println(UTC);
}
}
else if(BJT >= 1000 & BJT < 2359){
UTC = BJT - 800;
System.out.println(UTC);
}
else {
System.out.println("wrong number");
}
}
}
2 信號報(bào)告(5分)
題目內(nèi)容:
無線電臺(tái)的RS制信號報(bào)告是由三兩個(gè)部分組成的:
R(Readability) 信號可辨度即清晰度.
S(Strength) 信號強(qiáng)度即大小.
其中R位于報(bào)告第一位航缀,共分5級,用1—5數(shù)字表示.
1---Unreadable
2---Barely readable, occasional words distinguishable
3---Readable with considerable difficulty
4---Readable with practically no difficulty
5---Perfectly readable
報(bào)告第二位是S堰怨,共分九個(gè)級別芥玉,用1—9中的一位數(shù)字表示
1---Faint signals, barely perceptible
2---Very weak signals
3---Weak signals
4---Fair signals
5---Fairly good signals
6---Good signals
7---Moderately strong signals
8---Strong signals
9---Extremely strong signals
現(xiàn)在,你的程序要讀入一個(gè)信號報(bào)告的數(shù)字备图,然后輸出對應(yīng)的含義灿巧。如讀到59赶袄,則輸出:
Extremely strong signals, perfectly readable.
輸入格式:
一個(gè)整數(shù),信號報(bào)告抠藕。整數(shù)的十位部分表示可辨度饿肺,個(gè)位部分表示強(qiáng)度。輸入的整數(shù)范圍是[11,59]內(nèi)有效的數(shù)字盾似,這個(gè)范圍外的數(shù)字不可能出現(xiàn)在測試數(shù)據(jù)中敬辣。
輸出格式:
一句話,表示這個(gè)信號報(bào)告的意義零院。按照題目中的文字溉跃,先輸出表示強(qiáng)度的文字,跟上逗號和空格告抄,然后是表示可辨度的文字撰茎,跟上句號。注意可辨度的句子的第一個(gè)字母是小寫的玄妈。注意這里的標(biāo)點(diǎn)符號都是英文的乾吻。
輸入樣例:
33
輸出樣例:
Weak signals, readable with considerable difficulty.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int report = 11;
Scanner in = new Scanner(System.in);
report = in.nextInt();
if (report >= 11 && report <= 59) {
switch (report % 10){
case 1:
System.out.print("Faint signals, barely perceptible, ");
break;
case 2:
System.out.print("Very weak signals, ");
break;
case 3:
System.out.print("Weak signals, ");
break;
case 4:
System.out.print("Fair signals, ");
break;
case 5:
System.out.print("Fairly good signals, ");
break;
case 6:
System.out.print("Good signals, ");
break;
case 7:
System.out.print("oderately strong signals, ");
break;
case 8:
System.out.print("Strong signals, ");
break;
case 9:
System.out.print("Extremely strong signals, ");
break;
}
switch (report / 10){
case 1:
System.out.print("unreadable.");
break;
case 2:
System.out.print("barely readable, occasional words distinguishable.");
break;
case 3:
System.out.print("readable with considerable difficulty.");
break;
case 4:
System.out.print("readable with practically no difficulty.");
break;
case 5:
System.out.print("perfectly readable.");
break;
}
}
else {
System.out.println("Wrong value.");
}
}
}