题目
样例
解题思路
1、 这是水题,还是需要注意Ascii码的使用,和之前文章小仙女的烦恼是一种类型的题。
2、 注意一下定义最大值的方法,int max=Integer.MAX_VALUE;以及后面判断语句的格式。
参考代码
package Test;
import java.util.Scanner;
public class e {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0) {
int arr[]=new int [26];
for(int i=0;i<26;i++) {
arr[i]=sc.nextInt();
}
int max=Integer.MAX_VALUE;
int h=arr[7];
int e=arr['e'-'a'];
int l=arr['l'-'a']/3;
int o=arr['o'-'a']/2;
int w=arr['w'-'a'];
int r=arr['r'-'a'];
int d=arr[3];
max=(h<max ? h: max);
max=(e<max ? e: max);
max=(l<max ? l: max);
max=(o<max ? o: max);
max=(w<max ? w: max);
max=(r<max ? r: max);
max=(d<max ? d: max);
System.out.println(max);
}
}
}