Let's get some water problems to practiced hand.
1.poj1000
import Java.util.Scanner; /** * Created by Mxcsky on 2015/1/25. */ public class POJ1000 { static void main (string[] args) {Scanne r in = new Scanner (system.in); int a = In.nextint (); int b = In.nextint (); System.out.println (a + b); }}
2.poj1003
ImportJava.util.Scanner;/*** Created by Mxcsky on 2015/1/25.*/ Public classPOJ1003 { Public Static voidMain (string[] args) {Scanner in=NewScanner (system.in); while(true) { Doublem =in.nextdouble (); Doublesum = 0.0; inti = 1; if(M < 0.00001) {System.exit (0); } if(M <= 0.5) {System.out.println ("1 Card (s)"); } Else { while(Sum <m) {i++; Sum= SUM + 1.0/i; } System.out.println ((I-1) + "card (s)"); } } }}
3.poj1004
ImportJava.util.Scanner;/*** Created by Mxcsky on 2015/1/25.*/ Public classPOJ1004 { Public Static voidMain (string[] args) {Scanner in=NewScanner (system.in); Doublesum = 0.0; for(inti = 0; I < 12; i++) {sum= Sum +in.nextdouble (); } System.out.printf ("$%.2f", SUM/12); }}
Algorithm path--POJ brush problem (Java, continuous update)