360第二题 最后没提交啊,不知道对不对,求哪位大神看看
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
int[] arr = new int[T];
for (int i = 0; i < T; i++) {
int[] tm = new int[3];
tm[0] = sc.nextInt();
tm[1] = sc.nextInt();
tm[2] = sc.nextInt();
Arrays.sort(tm);
while (tm[2]>=2 && tm[1]>=1) {
tm[2] -= 2;
tm[1] -= 1;
arr[i]++;
Arrays.sort(tm);
}
if (tm[0]==1 && tm[1]==1 && tm[2]==1) {
arr[i]++;
}
}
sc.close();
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
}
#实习##笔试题目#
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
int[] arr = new int[T];
for (int i = 0; i < T; i++) {
int[] tm = new int[3];
tm[0] = sc.nextInt();
tm[1] = sc.nextInt();
tm[2] = sc.nextInt();
Arrays.sort(tm);
while (tm[2]>=2 && tm[1]>=1) {
tm[2] -= 2;
tm[1] -= 1;
arr[i]++;
Arrays.sort(tm);
}
if (tm[0]==1 && tm[1]==1 && tm[2]==1) {
arr[i]++;
}
}
sc.close();
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
}