为什么牛客和pat官网上pat怎么查看自己考过的题目目时间限制不一致?考试是哪一个为准?牛客1000ms,pat官网java好无奈啊。

没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!Sina Visitor System&nbsp>&nbsp
&nbsp>&nbsp
&nbsp>&nbsp
牛客网PAT乙级真题及java实现样例(持续更新中)
摘要:由于之前在PAT官网的练习场有时间限制,而且限制是针对c的基本上100ms到400ms,由于java需要虚拟机才能运行,因此有些题实在不是因为算法的原因才超时,牛客网的时间限制为1s,而且给我感觉后台服务器也比PAT官网跑的快,一样的程序PAT官网要80ms,牛客网只要20ms,因此我现在把代码提交到了牛客网。下面是牛客网乙级真题的题目和我实现的方法。1001.A+B和C题目描述给定区间[-2的31次方,2的31次方]内的3个整数A、B和C,请判断A+B是否大于C。输入描述:
由于之前在PAT官网的练习场有时间限制,而且限制是针对c的基本上100ms到400ms,由于java需要虚拟机才能运行,因此有些题实在不是因为算法的原因才超时,牛客网的时间限制为1s,而且给我感觉后台服务器也比PAT官网跑的快,一样的程序PAT官网要80ms,牛客网只要20ms,因此我现在把代码提交到了牛客网。下面是牛客网乙级真题的题目和我实现的方法。
1001.A+B和C
题目描述给定区间[-2的31次方, 2的31次方]内的3个整数A、B和C,请判断A+B是否大于C。输入描述:输入第1行给出正整数T(&=10),是测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以空格分隔。输出描述:对每组测试用例,在一行中输出“Case #X: true”如果A+B&C,否则输出“Case #X: false”,其中X是测试用例的编号(从1开始)。输入例子:41 2 32 3 4 0 0 - -输出例子:Case #1: falseCase #2: trueCase #3: trueCase #4: false
注:这个题目没什么难度,就是考虑整数会超过int长度,可以选择Long类型。代码如下所示:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.*;/** * * @author zjb */public class Main {
public static void main(String[] args){
//System.out.print(Integer.SIZE);
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
sc.nextLine();
List&String& list = new ArrayList();
for(int i=0; i&T; i++){
list.add(sc.nextLine());
for(int i=0; i&T; i++){
String[] strarr = list.get(i).split(& &);
long A = Long.parseLong(strarr[0]);
long B = Long.parseLong(strarr[1]);
long C = Long.parseLong(strarr[2]);
//System.out.print(A+& &+B+& &+C+& &);
if(A+B & C)
System.out.println(&Case #&+(i+1)+&: true&);
System.out.println(&Case #&+(i+1)+&: false&);
}}1002.数字分类
题目描述给定一系列正整数,请按要求对数字进行分类,并输出以下5个数字:A1 = 能被5整除的数字中所有偶数的和;A2 = 将被5除后余1的数字按给出顺序进行交错求和,即计算n1-n2+n3-n4...;A3 = 被5除后余2的数字的个数;A4 = 被5除后余3的数字的平均数,精确到小数点后1位;A5 = 被5除后余4的数字中最大数字。输入描述:每个输入包含1个测试用例。每个测试用例先给出一个不超过1000的正整数N,随后给出N个不超过1000的待分类的正整数。数字间以空格分隔。输出描述:对给定的N个正整数,按题目要求计算A1~A5并在一行中顺序输出。数字间以空格分隔,但行末不得有多余空格。若其中某一类数字不存在,则在相应位置输出“N”。输入例子:13 1 2 3 4 5 6 7 8 9 10 20 16 18输出例子:30 11 2 9.7 9
注:这个题目也没什么难度就是计算的时候可以考虑一些重复计算的东西,尽量程序中不要出现重复计算的代码。实现代码如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.S/** * * @author zjb */public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int A1 = 0;
int A2 = 0;
int flag = 1;
int numA2 = 0;
int A3 = 0;
double A4 = 0;
int numA4 = 0;
//int[] arrA5 = new int[1000];
int A5 = 0;
int index = 0;
boolean flagA5 =
for(int i=0; i&N; i++){
num = sc.nextInt();
if(num%10 == 0)
else if(num%5 ==1){
A2 = flag*num + A2;
flag *= -1;
else if(num%5 == 2 )
else if(num%5 == 3 ){
else if(num%5 == 4 )
if(!flagA5){
if(num &= A5)
System.out.print(A1);
System.out.print(&N&);
if(numA2&0)
System.out.print(& &+A2);
System.out.print(& N&);
System.out.print(& &+A3);
System.out.print(& N&);
if(numA4 &0){
A4 = A4/numA4;
System.out.printf(& %.1f&,A4);
System.out.print(& N&);
if(flagA5){
System.out.print(& &+A5);
System.out.print(& N&);
}}1003.数素数
题目描述令Pi表示第i个素数。现任给两个正整数M &= N &= 10000,请输出PM到PN的所有素数。输入描述:输入在一行中给出M和N,其间以空格分隔。输出描述:输出从PM到PN的所有素数,每10个数字占1行,其间以空格分隔,但行末不得有多余空格。输入例子:5 27输出例子:11 13 17 19 23 29 31 37 41 4347 53 59 61 67 71 73 79 83 8997 101 103注:这个题目需要注意的地方是在判断素数的时候只要从2开始到sqrt(m)。如果从2到m-1的话,就可能造成超时。代码如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.*;/** * * @author zjb */public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int M = sc.nextInt();
int N = sc.nextInt();
int numPrime = 0;
int numPrint = 0;
while(true){
/* if(i&2)
if(isPrime(i)){
numPrime++;
if(numPrime&=M &;&; numPrime&=N){
numPrint ++;
if(numPrint%10 == 1)
System.out.print(i);
else if(numPrint%10 == 0)
System.out.println(& &+i);
System.out.print(& &+i);
if(numPrime & N)
public static boolean isPrime(int num){
if(num &2)
if(num ==2)
for(int i=2; i&Math.sqrt(num)+1; i++){
if(num%i == 0)
}}1004.福尔摩斯的约会
题目描述大侦探福尔摩斯接到一张奇怪的字条:“我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&;hgsfdk d&;Hyscvnm”。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间“星期四 14:04”,因为前面两字符串中第1对相同的大写英文字母(大小写有区分)是第4个字母'D',代表星期四;第2对相同的字符是'E',那是第5个英文字母,代表一天里的第14个钟头(于是一天的0点到23点由数字0到9、以及大写字母A到N表示);后面两字符串第1对相同的英文字母's'出现在第4个位置(从0开始计数)上,代表第4分钟。现给定两对字符串,请帮助福尔摩斯解码得到约会的时间。输入描述:输入在4行中分别给出4个非空、不包含空格、且长度不超过60的字符串。输出描述:在一行中输出约会的时间,格式为“DAY HH:MM”,其中“DAY”是某星期的3字符缩写,即MON表示星期一,TUE表示星期二,WED表示星期三,THU表示星期四,FRI表示星期五,SAT表示星期六,SUN表示星期日。题目输入保证每个测试存在唯一解。输入例子:3485djDkxh4hhGE2984akDfkkkkggEdsbs&;hgsfdkd&;Hyscvnm输出例子:THU 14:04
注:这个题目需要注意的是当小时和分钟小于10的时候要在前面输出0。代码如下所示:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.*;/** * * @author zjb */public class Main {
public static void main(String agrs[]){
Scanner sc = new Scanner(System.in);
String str1 = sc.nextLine();
String str2 = sc.nextLine();
String str3 = sc.nextLine();
String str4 = sc.nextLine();
char char1 = '0';
char char2 = '0';
int charnum = 0;
for(int i=0; (i&Math.min(str1.length(), str2.length())&;&;charnum&2); i++){
char ch = str1.charAt(i);
if(charnum == 0 &;&; ch==str2.charAt(i) &;&; ch&='A'&;&;ch&='G'){
charnum++;
if(charnum == 1&;&;(ch==str2.charAt(i))
&;&;(ch&='A'&;&;ch&='N'||ch&='0'&;&;ch&='9')){
charnum++;
int index = 0;
for(int i=0; i&Math.min(str3.length(), str4.length());i++){
int ch = str3.charAt(i);
if(ch == str4.charAt(i)&;&;(ch&='a'&;&;ch&='z'||ch&='A'&;&;ch&='Z')){
String out = new String();
switch(char1){
out += &MON &;
out += &TUE &;
out += &WED &;
out += &THU &;
out += &FRI &;
out += &SAT &;
out += &SUN &;
if(char2&='9')
out += &0&+char2;
out += char2 - 'A' +10;
if(index&10)
out += &:&+
System.out.println(out);
1005.德才论
题目描述宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。”现给出一批考生的德才分数,请根据司马光的理论给出录取排名。输入描述:输入第1行给出3个正整数,分别为:N(&=105),即考生总数;L(&=60),为录取最低分数线,即德分和才分均不低于L的考生才有资格被考虑录取;H(&100),为优先录取线——德分和才分均不低于此线的被定义为“才德全尽”,此类考生按德才总分从高到低排序;才分不到但德分到线的一类考生属于“德胜才”,也按总分排序,但排在第一类考生之后;德才分均低于H,但是德分不低于才分的考生属于“才德兼亡”但尚有“德胜才”者,按总分排序,但排在第二类考生之后;其他达到最低线L的考生也按总分排序,但排在第三类考生之后。随后N行,每行给出一位考生的信息,包括:准考证号、德分、才分,其中准考证号为8位整数,德才分为区间[0, 100]内的整数。数字间以空格分隔。输出描述:输出第1行首先给出达到最低分数线的考生人数M,随后M行,每行按照输入格式输出一位考生的信息,考生按输入中说明的规则从高到低排序。当某类考生中有多人总分相同时,按其德分降序排列;若德分也并列,则按准考证号的升序输出。输入例子:14 60 80 90 60 80 80 85 77 76 78 79 90 45 100 99 60输出例子:12 99 100 80 80 85 78 76 77 60 60 79 90
注:这个题目关键是排序,排序的时候自己实现comparator接口需要使用内部类。代码如下
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.*;/** * * @author zjb */public class Main{
public static class CMP implements Comparator&String&{
public int compare(String str1,String str2){
String[] strarr1 = str1.split(& &);
String[] strarr2 = str2.split(& &);
if(Integer.parseInt(strarr1[1])+Integer.parseInt(strarr1[2]) &
Integer.parseInt(strarr2[1])+Integer.parseInt(strarr2[2]))
return -1;
else if(Integer.parseInt(strarr1[1])+Integer.parseInt(strarr1[2]) &
Integer.parseInt(strarr2[1])+Integer.parseInt(strarr2[2]))
if(Integer.parseInt(strarr1[1]) & Integer.parseInt(strarr2[1]))
return -1;
else if(Integer.parseInt(strarr1[1]) & Integer.parseInt(strarr2[1]))
if(Integer.parseInt(strarr1[0]) & Integer.parseInt(strarr2[0]))
return -1;
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int L = sc.nextInt();
int H = sc.nextInt();
//List&String& list = new ArrayList();
List&String& caideqj = new ArrayList();
List&String& deshengc = new ArrayList();
List&String& caidejw = new ArrayList();
List&String& other = new ArrayList();
sc.nextLine();
for(int i=0; i&N; i++){
String str
= sc.nextLine();
String[] strarr = str.split(& &);
if(Integer.parseInt(strarr[1])&=L &;&; Integer.parseInt(strarr[2])&=L){
if(Integer.parseInt(strarr[1])&=H &;&; Integer.parseInt(strarr[2])&=H){
caideqj.add(str);
else if(Integer.parseInt(strarr[1])&=H &;&; Integer.parseInt(strarr[2])&H){
deshengc.add(str);
else if(Integer.parseInt(strarr[1])&H &;&; Integer.parseInt(strarr[2])&H
&;&; Integer.parseInt(strarr[1])&=Integer.parseInt(strarr[2])){
caidejw.add(str);
other.add(str);
System.out.println(caideqj.size()+deshengc.size()+caidejw.size()+other.size());
CMP cmp = new CMP();
if(caideqj.size()&1)
Collections.sort(caideqj, cmp);
if(deshengc.size()&1)
Collections.sort(deshengc, cmp);
if(caidejw.size()&1)
Collections.sort(caidejw, cmp);
if(other.size()&1)
Collections.sort(other, cmp);
for(int i=0; i&caideqj.size(); i++){
System.out.println(caideqj.get(i));
for(int i=0; i&deshengc.size(); i++){
System.out.println(deshengc.get(i));
for(int i=0; i&caidejw.size(); i++){
System.out.println(caidejw.get(i));
for(int i=0; i&other.size(); i++){
System.out.println(other.get(i));
1006.部分A+B
题目描述正整数A的“DA(为1位整数)部分”定义为由A中所有DA组成的新整数PA。例如:给定A = 3862767,DA = 6,则A的“6部分”PA是66,因为A中有2个6。现给定A、DA、B、DB,请编写程序计算PA + PB。输入描述:输入在一行中依次给出A、DA、B、DB,中间以空格分隔,其中0 & A, B & 1010。输出描述:在一行中输出PA + PB的值。输入例子: 输出例子:399
注:这个题目很简单没有什么需要注意的点,代码如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.*;/** * * @author zjb */public class Main {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int DA = sc.nextInt();
int B = sc.nextInt();
int DB = sc.nextInt();
int PA = 0;
int PB = 0;
while(A&0){
int num = A%10;
if(num == DA)
PA = PA*10 + DA;
while(B&0){
int num = B%10;
if(num == DB)
PB = PB*10 + DB;
System.out.println(PA+PB);
}}1007.A除以B
题目描述本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A = B * Q + R成立。输入描述:输入在1行中依次给出A和B,中间以1空格分隔。输出描述:在1行中依次输出Q和R,中间以1空格分隔。输入例子:输出例子:
注:由于题目要求的是不超过1000位的正整数,因此利用数据类型接收输入肯定是不行的,这个时候需要利用整形数组接收输入,然后利用除法的基本原理求解,代码如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.*;/** * * @author zjb */public class Main {
public static void main(String[] args){
List&Integer& list = new ArrayList();
Scanner sc = new Scanner(System.in);
String strA = sc.next();
int B = sc.nextInt();
int temp = 0;
for(int i=0; i&strA.length(); i++){
temp = temp*10 + strA.charAt(i)-'0';
if(temp & B)
list.add(0);
list.add(temp/B);
temp = temp % B;
for(int i=0; i&list.size(); i++){
if(i==0 &;&; list.get(i)==0)
System.out.print(list.get(i));
System.out.println(& &+temp);
}}1008.锤子剪刀布
题目描述大家应该都会玩“锤子剪刀布”的游戏:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。输入描述:输入第1行给出正整数N(&=105),即双方交锋的次数。随后N行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C代表“锤子”、J代表“剪刀”、B代表“布”,第1个字母代表甲方,第2个代表乙方,中间有1个空格。输出描述:输出第1、2行分别给出甲、乙的胜、平、负次数,数字间以1个空格分隔。第3行给出两个字母,分别代表甲、乙获胜次数最多的手势,中间有1个空格。如果解不唯一,则输出按字母序最小的解。输入例子:10C JJ BC BB BB CC CC BJ BB CJ J输出例子:5 3 22 3 5B B
注:这个题目需要注意的是三者之间的关系,还有甲乙的胜负之间的关系,代码如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.S/** * * @author zjb */public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
sc.nextLine();
int winCA = 0;
int winCB = 0;
int winJA = 0;
int winJB = 0;
int winBA = 0;
int winBB = 0;
// System.out.println(N);
for(int i=0; i&N; i++){
String str = sc.nextLine();
//System.out.println(str);
//String strB = sc.nextLine();
char chA = str.charAt(0);
char chB = str.charAt(2);
if(chA == 'C'){
if(chB == 'J')
else if(chB == 'B')
else if(chA == 'J'){
if(chB == 'B')
else if(chB == 'C')
else if(chA == 'B'){
if(chB == 'C')
else if(chB == 'J')
int totalwinA = winCA+winJA+winBA;
int totalwinB = winCB+winJB+winBB;
int totalping = N-(winCA+winJA+winBA+winCB+winJB+winBB);
System.out.println(totalwinA+& &+totalping+& &+totalwinB);
System.out.println(totalwinB+& &+totalping+& &+totalwinA);
System.out.println(findmax(winCA,winJA,winBA)+& &+findmax(winCB,winJB,winBB));
public static char findmax(int winC, int winJ, int winB){
char max = 'B';
int maxnum = winB;
if(maxnum & winC){
max = 'C';
maxnum = winC;
if(maxnum & winJ){
max = 'J';
maxnum = winJ;
}}1009.数字黑洞
给定任一个各位数字不完全相同的4位正整数,如果我们先把4个数字按非递增排序,再按非递减排序,然后用第1个数字减第2个数字,将得到
一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的6174,这个神奇的数字也叫Kaprekar常数。
例如,我们从6767开始,将得到
7766 - 6677 = 1089
9810 - 0189 = 9621
9621 - 1269 = 8352
8532 - 2358 = 6174
7641 - 1467 = 6174
现给定任意4位正整数,请编写程序演示到达黑洞的过程。
输入给出一个(0, 10000)区间内的正整数N。
如果N的4位数字全相等,则在一行内输出“N - N = 0000”;否则将计算的每一步在一行内输出,直到6174作为差出现,输出格式见样例。注意每个数字按4位数格
7766 - 6677 = 1089
9810 - 0189 = 9621
9621 - 1269 = 8352
8532 - 2358 = 6174
注:这个题目需要注意的是当输入不足4位的时候需要用0在前面补齐。代码如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */import java.util.Aimport java.util.Cimport java.util.Cimport java.util.S/** * * @author zjb */public class Main {
public static class CMP implements Comparator&Integer&{
public int compare(Integer o1, Integer o2) {
if(o1 & o2)
return -1;
else if(o1 & o2)
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
Integer a[] = new Integer[4];
if(str.length() == 1){
a[0] = a[1] = a[2] = 0;
a[3] = str.charAt(0) - '0';
else if(str.length() == 2){
a[0] = a[1] = 0;
a[2] = str.charAt(0) - '0';
a[3] = str.charAt(1) - '0';
else if(str.length() == 3){
a[1] = str.charAt(0) - '0';
a[2] = str.charAt(1) - '0';
a[3] = str.charAt(2) - '0';
if(str.charAt(0) == str.charAt(1) &;&; str.charAt(1)== str.charAt(2)
&;&; str.charAt(2) == str.charAt(3))
System.out.println(str+& - &+str+& = 0000&);*/
for(int i =0; i&4; i++){
a[i] = str.charAt(i) - '0';
if(a[0] == a[1] &;&; a[2] == a[1] &;&; a[3] == a[2]){
String out = &&+a[0]+a[1]+a[2]+a[3];
System.out.println(out+& - &+out+& = 0000&);
int num1 = 0;
int num2 = 0;
int differ = 0;
CMP cmp = new CMP();
// Integer[] temp = new Integer[4];
Arrays.sort(a,cmp);
num1 = 1000*a[0] + 100*a[1] + 10*a[2] + a[3];
for(int i=0; i&4; i++){
System.out.print(a[i]);
System.out.print(& - &);
Arrays.sort(a);
num2 = 1000*a[0] + 100*a[1] + 10*a[2] + a[3];
for(int i=0; i&4; i++){
System.out.print(a[i]);
differ = num1 - num2;
System.out.println(& = &+differ);
a[0] = differ/1000;
differ = differ%1000;
a[1] = differ/100;
differ = differ%100;
a[2] = differ/10;
differ = differ%10;
// Collections.sort(a);
}while((num1 - num2) != 6174);
题目描述月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有3种月饼,其库存量分别为18、15、10万吨,总售价分别为75、72、45亿元。如果市场的最大需求量只有20万吨,那么我们最大收益策略应该是卖出全部15万吨第2种月饼、以及5万吨第3种月饼,获得72 + 45/2 = 94.5(亿元)。输入描述:每个输入包含1个测试用例。每个测试用例先给出一个不超过1000的正整数N表示月饼的种类数、以及不超过500(以万吨为单位)的正整数D表示市场最大需求量。随后一行给出N个正数表示每种月饼的库存量(以万吨为单位);最后一行给出N个正数表示每种月饼的总售价(以亿元为单位)。数字间以空格分隔。输出描述:对每组测试用例,在一行中输出最大收益,以亿元为单位并精确到小数点后2位。输入例子:3 2018 15 1075 72 45
输出例子:94.50
注:这个题目其实很简单,主要意思就是单价,单价高的卖出的自然越多越好,明白这点题目就很简单了。代码如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */package com.pat.import java.util.ArrayLimport java.util.Cimport java.util.Cimport java.util.Limport java.util.S/** * * @author zjb */public class B1020 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
List&yuebing& list = new ArrayList();
int N = sc.nextInt();
int D = sc.nextInt();
sc.nextLine();
double sum = 0;
String[] arrsize = sc.nextLine().split(& &);
String[] arrtotal = sc.nextLine().split(& &);
for(int i=0; i&N; i++){
yuebing yb = new yuebing();
yb.size = Integer.parseInt(arrsize[i]);
yb.totalprice = Integer.parseInt(arrtotal[i]);
yb.price = yb.totalprice*1.0/yb.
list.add(yb);
if(N == 1){
if(list.get(0).size &= D)
System.out.printf(&%.2f/n&,(double)list.get(0).totalprice);
System.out.printf(&%.2f/n&, (double)(list.get(0).price*D));
CMP cmp = new CMP();
Collections.sort(list, cmp);
for(int i=0; i&N&;&;D&0; i++){
if(list.get(i).size &= D){
sum += list.get(i).
D = D - list.get(i).
sum += list.get(i).price*D;
System.out.printf(&%.2f/n&,sum);
private static class yuebing{
public static class CMP implements Comparator&yuebing&{
public int compare(yuebing yb1, yuebing yb2){
if(yb1.price & yb2.price)
return -1;
else if(yb1.price & yb2.price)
以上是的内容,更多
的内容,请您使用右上方搜索功能获取相关信息。
若你要投稿、删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内给你回复。
云服务器 ECS
可弹性伸缩、安全稳定、简单易用
&40.8元/月起
预测未发生的攻击
&24元/月起
为您提供0门槛上云实践机会
你可能还喜欢
你可能感兴趣
阿里云教程中心为您免费提供
牛客网PAT乙级真题及java实现样例(持续更新中)相关信息,包括
的信息,所有牛客网PAT乙级真题及java实现样例(持续更新中)相关内容均不代表阿里云的意见!投稿删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内答复
售前咨询热线
支持与服务
资源和社区
关注阿里云
International

我要回帖

更多关于 pat题库总共多少题 的文章

 

随机推荐