import java.util.Scanner;
public class g2020{
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
String s = sc.nextLine();
int max = 0;
int index = 0;
String a = "abcdefghijklmnopqrstuvwxyz";
int b[] = new int[26];
for(int i = 0;i<s.length();i++){
b[a.indexOf(s.charAt(i))]++;
}
for(int j = 0;j<b.length;j++){
if(b[j]>max){
max = b[j];
index = j;
}
}
System.out.println(a.substring(index,index+1));
System.out.println(max);
}}
第十届2019-4外卖优先级(15分)
package g;
import java.util.HashMap;
import java.util.Scanner;
public class g2019 {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int m = cin.nextInt();
int t = cin.nextInt();
//首先我们需要有一张关于店铺Id和时间的二维数组
int[][] orderShops = new int[n+1][t+1];
//然后我们需要显示店铺的优先级
int[] countShops = new int[n+1];
//分别输入m行ts时刻id店铺设置为一
HashMap<Integer,Integer> hashMap = new HashMap<>();
for(int i =0;i<m;i++){
int ts = cin.nextInt();
int id = cin.nextInt();
orderShops[id][ts] ++;
}
for(int i =1;i <= n;i++){
for(int j =1;j <= t;j++){
//在j时刻店铺i没有订单,优先级减1
if(orderShops[i][j]==0){
countShops[i] = Math.max(0,countShops[i]-1);
}else {
//有订单的时候
countShops[i] +=orderShops[i][j]*2;
}
//每个时刻都需要自己去不断刷新,然后判断哪些在缓存对列的去留
if(countShops[i] >5){
hashMap.put(i,1);
}
if(countShops[i] <=3 && hashMap.containsKey(i)){
hashMap.remove(i);
}
}
}
System.out.println(hashMap.size());
cin.close();
}
}
第九届2018-4递增三元组(15分)
package g;
import java.util.Arrays;
import java.util.Scanner;
public class g2018 {
public static void main(String[] args) {
long ans=0;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] A = new int[n];
int[] B = new int[n];
int[] C = new int[n];
for (int i = 0; i < n; i++)
A[i] = sc.nextInt();
for (int i = 0; i < n; i++)
B[i] = sc.nextInt();
for (int i = 0; i < n; i++)
C[i] = sc.nextInt();
Arrays.sort(A);
Arrays.sort(B);
Arrays.sort(C);
int p=0;
int q=0;
for(int i=0;i<n;i++){
while(p<n&&A[p]<B[i])p++;
while(q<n&&C[q]<=B[i])q++;
ans+=p*(n-q);
}
System.out.println(ans); }}