| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
水题之王,我无语了…… 考的其实是顺时针和逆时针转到下一个数的计算方法,俩种情况import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (true) {
int begin = in.nextInt();
int one = in.nextInt();
int two = in.nextInt();
int three = in.nextInt();
if ((begin | one | two | three) == 0)
break;
int result = 1080;
result += begin < one ? (begin + 40 - one) * 9 : (begin - one) * 9;
result += one < two ? (two - one) * 9 : (40 + two - one) * 9;
result += two < three ? (two + 40 - three) * 9 : (two - three) * 9;
System.out.println(result);
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator