import java.util.*; public class Main {         public static void main(String[] args) {                 Scanner in = new Scanner(System.in);                 int t = in.nextInt();                 int[] org = new int[t];                 for(int i = 0;i < t;i++) {                         org[i] = in.nextInt();                     }                String s = null;                     for(int j:org) {                             if(j%5==0) s="yang";                             else if(j%5==1) s="niu";                             else if(j%5==2) s="yang";                             else if(j%5==3) s="niu";                             else s="niu";                                 System.out.println(s);                 }     } } 这是青草问题 import java.util.*; public class Main {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         String s = in.next();         int k = in.nextInt();         int[] mark = new int[26];         for(int i = 0;i < s.length();i++) {             mark[s.charAt(i)-'a']++;         }         Arrays.sort(mark);         for(int i = 0;i < k;i++) {             mark[0]--;             Arrays.sort(mark);         }                  int count =0;         for(int res:mark) {             if(res !=0)                 count = count+res*res;         }         System.out.println(count);     } } 字符串价值
点赞 评论

相关推荐

09-30 15:27
已编辑
成都工业学院 企业文化
Morpheus_:候选人:还需要测验武力值?
投递腾讯等公司10个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务