[] Bubblesortresult =px. Bubblesort (score); for(inti=0;i) {System.out.print (Bubblesortresult[i]+" "); } } /** Bubble sort * @param score score (0-10 points) * @return return count array * Description: There are n number, two adjacent number comparison, if the previous number is smaller than the number of the subsequent exchange position, assuming that a minimum number is placed in the most Back to a trip, you need to compare 1~n-1, set the number of times I, each trip compared to 1~n
The
problem description is given a sequence of length n, which arranges the sequence in small to large order. 1The second row contains n integers, and the absolute value of each integer is less than 10000 for the number to be sorted. Output format output one line, the sorted sequence is output in order from small to large. Sample Input 5
8 3 6 4 9 Sample output 3 4 6 8 9
Collection Sort:Importjava.util.ArrayList;ImportJava.util.Comparator;Importjava.util.List;ImportJava.util.Scanne
I seriously probation the book today, first of all, according to the author's habit of reading, like to look at the front of the first part. In the preface, the author put a road map of learning Java, which is a standard learning process. But why put a design pattern in the programming advanced, and then the next is the abstract class and interface, package and access rights (this name and
Practice 1:1 people very unlucky, accidentally smashed a woman's basket of eggs. Ask how many eggs are in the basket for compensation.The woman said, she is not clear, only remember to take two each time one, each take 3 is left 2,Take 5 each time Left 4, if each egg 1 yuan, ask you to help programming, calculate the minimum should pay how much money?Requirements: With the Loop statement implementation, directly print out the results do not give points.Package Com.cdp.project;public class Task1
Write a class a, the object created by the class can call the method F output lowercase English alphabet. ThenThen write a subclass B of class a , requiring subclass b to inherit the method F of class a (Overrides are not allowed), The object created by subclass B can not only call the method F output lowercase English alphabet, but also can call the childClass New Method g output uppercase English alphabet. Finally write the main class C, the main method in the master classTest class A with
Package Practicego;import java.util.scanner;/* * 6, the computer randomly generated a number of 0~9, the user to guess the number.The value is correct until it is guessed correctly. */public class Cto {public static void main (string[] args) {Scanner sc = new Scanner (system.in), while (true) {System.out.pri NTLN ("Guess number:"), int pernum = Sc.nextint (), int sysnum = (int) (Math.random () *10), if (Sysnum = = Pernum) {System.out.println (" Congratulations, you guessed it!! "); break;}}}Test
/*x binary to y conversion * //*step1. Prompting the user to enter data into the X*STEP2. Receive user input data, save to X* Scanner Method*step3. Receive user input X-data, save to Num*step4. Prompting the user to enter the output data in the binary y*step5. Receive user input data, save to Y* Scanner Method*step6. Decimal = Each one on the (coefficient *x^ power) added, save to a* x-binary Conversion decimal*step7.y binary =a/y, take the remainder until the quotient is zero, the remainder is
ImportJava.text.DecimalFormat;ImportJava.text.NumberFormat;/** Output: A, A, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, 44. A, a, a, and A; */ Public classOutputpattern { Public Static voidMain (string[] args) {//DecimalFormat formatted outputDecimalFormat Dfnum =(DecimalFormat) numberformat.getinstance (); Dfnum.applypattern ("00"); for(inti = 2; I ) { if(i% 10! = 0) {System.out.print (Dfnum.format (i)+ "A"); } Else{System.out.print (Dfnum.format (i)+ "A"); System.o
Title: Vampire numbers are numbers with an even number of digits that can be multiplied by a pair of numbers, which each contain a number of half-digits of the product, where the number selected from the initial number can be arbitrarily sorted. Numbers ending in two 0 are not allowed, for example, the following numbers are "vampire" numbers:1260=21*601827=21*872187=27*81Write a program to find out 4-digit numbers of all vampires./** * Java Programm
=Getminarray (A); MAXB=Getmaxarray (B); } Else{result+ = A[mina] *B[MAXB]; A[mina]= 2000;//indicates that this element is already in useB[MAXB] = 2000; //after a set of data is obtained, the maximum and minimum values for A and B are updatedMinA =Getminarray (A); MAXB=Getmaxarray (B); MaxA=Getmaxarray (A); MINB=Getminarray (B); } } returnresult; } Public Static voidMain (string[] args) {main test=NewMain (); Scanner in=NewScanner (system.in); //System.out.println ("Please e
5. Enter a positive integer n from the keyboard, according to the following five-Yang Hui triangle display method,Outputs the first n rows of the Yang Hui Triangle. Use loop control statements to implement.(The number on the waist of the triangle is 1, and the number of the other position is the sum of the two adjacent rows.) )11 11 2 11 3 3 11 4 6) 4 11 5 10 10 5 1Scanner sc=new Scanner (System. in);System. out. println ("Enter a number to print Yang Hui triangle:");int t=sc.nextint ();int []
Creates a set of vowel letters. For Uniquewords.java operations, counts and displays the number of vowels in each input word and displays the sum of all the vowels in the input file. Public classVOWELS6 {Static voidVowelcounter (setSt) {SetNewTreeset(); Collections.addall (Vowels,' A ', ' e ', ' I ', ' o ', ' u ', ' a ', ' e ', ' I ', ' o ', ' u '); intAllvowels = 0; for(String s:st) {intCount = 0; for(Character V:s.tochararray ()) {if(Vowels.contains (v)) {count++; Allvowels++; }} System.out.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.