hdu oj

2000

 1 import java.util.Scanner;
 2 
 3 public class Main {
 4     public static void main(String[] args) {
 5         Scanner in = new Scanner(System.in);
 6         while (in.hasNext()) {
 7             String s = in.next();
 8             char c1 = s.charAt(0);
 9             char c2 = s.charAt(1);
10             char c3 = s.charAt(2);
11             char t;
12             if (c1 > c2) {
13                 t = c1;
14                 c1 = c2;
15                 c2 = t;
16             }
17             if (c2 > c3) {
18                 {
19                     t = c2;
20                     c2 = c3;
21                     c3 = t;
22                 }
23                 if (c1 > c2) {
24                     t = c1;
25                     c1 = c2;
26                     c2 = t;
27                 }
28             }
29             System.out.println(c1 + " " + c2 + " " + c3);
30         }
31     }
32 }
View Code

 2001

 1 import java.text.DecimalFormat;
 2 import java.util.Scanner;
 3 
 4 public class Main {
 5     public static void main(String[] args) {
 6         Scanner in = new Scanner(System.in);
 7         DecimalFormat df = new DecimalFormat("#0.00");
 8         while (in.hasNext()) {
 9             double x1 = in.nextDouble();
10             double y1 = in.nextDouble();
11             double x2 = in.nextDouble();
12             double y2 = in.nextDouble();
13             double distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2)
14                     * (y1 - y2));
15             System.out.println(df.format(distance));
16         }
17     }
18 }
View Code

 

posted on 2013-07-07 11:40  P,Z  阅读(385)  评论(0编辑  收藏  举报