Submission #197136
Source Code Expand
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
int[] a = new int[3];
int[] b = new int[3];
Scanner sc = new Scanner(System.in);
for(int i = 0; i < 3; i++) {
a[i] = sc.nextInt();
}
for(int i = 0; i < 3; i++) {
b[i] = sc.nextInt();
}
int[][] dist = new int[3][3];
int ret = 0;
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
dist[i][j] = Math.abs(a[i] - b[j]);
}
}
boolean[] flag = new boolean[3];
ret = Integer.MAX_VALUE;
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
for(int k = 0; k < 3; k++) {
if(i == j || j == k || k == i)
continue;
ret = Math.min(ret,dist[0][i] + dist[1][j] + dist[2][k]);
}
}
}
System.out.println(ret);
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - マッサージチェア |
| User | sorekara |
| Language | Java (OpenJDK 1.7.0) |
| Score | 100 |
| Code Size | 823 Byte |
| Status | AC |
| Exec Time | 368 ms |
| Memory | 22708 KiB |
Judge Result
| Set Name | All | ||
|---|---|---|---|
| Score / Max Score | 100 / 100 | ||
| Status |
|
| Set Name | Test Cases |
|---|---|
| All | random-00.txt, random-01.txt, random-02.txt, random-03.txt, random-04.txt, random-05.txt, random-06.txt, random-07.txt, random-08.txt, random-09.txt, random-10.txt, random-11.txt, random-12.txt, random-13.txt, random-14.txt, random-15.txt, random-16.txt, random-17.txt, random-18.txt, random-19.txt, test-00.txt, test-01.txt, test-02.txt, test-03.txt, test-04.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| random-00.txt | AC | 350 ms | 22580 KiB |
| random-01.txt | AC | 343 ms | 22580 KiB |
| random-02.txt | AC | 343 ms | 22580 KiB |
| random-03.txt | AC | 345 ms | 22704 KiB |
| random-04.txt | AC | 347 ms | 22708 KiB |
| random-05.txt | AC | 344 ms | 22704 KiB |
| random-06.txt | AC | 355 ms | 22580 KiB |
| random-07.txt | AC | 361 ms | 22576 KiB |
| random-08.txt | AC | 354 ms | 22700 KiB |
| random-09.txt | AC | 356 ms | 22704 KiB |
| random-10.txt | AC | 354 ms | 22576 KiB |
| random-11.txt | AC | 353 ms | 22704 KiB |
| random-12.txt | AC | 354 ms | 22576 KiB |
| random-13.txt | AC | 350 ms | 22708 KiB |
| random-14.txt | AC | 354 ms | 22644 KiB |
| random-15.txt | AC | 353 ms | 22704 KiB |
| random-16.txt | AC | 355 ms | 22580 KiB |
| random-17.txt | AC | 351 ms | 22576 KiB |
| random-18.txt | AC | 354 ms | 22704 KiB |
| random-19.txt | AC | 368 ms | 22576 KiB |
| test-00.txt | AC | 357 ms | 22576 KiB |
| test-01.txt | AC | 351 ms | 22704 KiB |
| test-02.txt | AC | 354 ms | 22704 KiB |
| test-03.txt | AC | 356 ms | 22708 KiB |
| test-04.txt | AC | 355 ms | 22704 KiB |