diff --git a/.DS_Store b/.DS_Store index 64c46c9..d2ae65f 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Java Experiments/.DS_Store b/Java Experiments/.DS_Store new file mode 100644 index 0000000..b5258aa Binary files /dev/null and b/Java Experiments/.DS_Store differ diff --git a/Java Experiments/A/.DS_Store b/Java Experiments/A/.DS_Store new file mode 100644 index 0000000..9314a78 Binary files /dev/null and b/Java Experiments/A/.DS_Store differ diff --git a/Java Experiments/A/A+B Problem.java b/Java Experiments/A/A+B Problem.java new file mode 100644 index 0000000..2d43715 --- /dev/null +++ b/Java Experiments/A/A+B Problem.java @@ -0,0 +1,14 @@ +import java.util.Scanner; + +public class Main +{ + public static void main(String [] args) + { + Scanner Data = new Scanner(System.in); + int a,b; + a=Data.nextInt(); + b= Data.nextInt(); + System.out.printf("%d",a+b); + Data.close(); + } +} \ No newline at end of file diff --git a/Java Experiments/A/A+B for Input-Output Practice (I).java b/Java Experiments/A/A+B for Input-Output Practice (I).java new file mode 100644 index 0000000..4e1b546 --- /dev/null +++ b/Java Experiments/A/A+B for Input-Output Practice (I).java @@ -0,0 +1,18 @@ +import java.util.Scanner; + +public class Main +{ + public static void main(String [] args) + { + Scanner Data = new Scanner(System.in); + int a,b; + + while(Data.hasNextInt()) + { + a=Data.nextInt(); + b=Data.nextInt(); + + System.out.printf("%d\n",a+b); + } + } +} \ No newline at end of file diff --git a/Java Experiments/A/A+B for Input-Output Practice (III).java b/Java Experiments/A/A+B for Input-Output Practice (III).java new file mode 100644 index 0000000..6cd5d86 --- /dev/null +++ b/Java Experiments/A/A+B for Input-Output Practice (III).java @@ -0,0 +1,21 @@ +import java.util.Scanner; + +public class Main +{ + public static void main(String [] args) + { + Scanner Data = new Scanner(System.in); + + int n,a,b; + + n=Data.nextInt(); + while(n!=0) + { + a=Data.nextInt(); + b=Data.nextInt(); + + System.out.printf("%d\n",a+b); + n--; + } + } +} \ No newline at end of file diff --git a/Java Experiments/A/A+B for Input-Output Practice (IV).java b/Java Experiments/A/A+B for Input-Output Practice (IV).java new file mode 100644 index 0000000..d69c63e --- /dev/null +++ b/Java Experiments/A/A+B for Input-Output Practice (IV).java @@ -0,0 +1,27 @@ +import java.util.*; + +public class Main +{ + public static void main(String [] args) + { + Scanner Data = new Scanner(System.in); + + int n,a; + int sum; + while(true) + { + sum=0; + n=Data.nextInt(); + if(n==0) + break; + + while(n!=0) + { + a=Data.nextInt(); + sum+=a; + n--; + } + System.out.printf("%d\n",sum); + } + } +} diff --git a/Java Experiments/A/A+B for Input-Output Practice (V).java b/Java Experiments/A/A+B for Input-Output Practice (V).java new file mode 100644 index 0000000..ccf2d29 --- /dev/null +++ b/Java Experiments/A/A+B for Input-Output Practice (V).java @@ -0,0 +1,30 @@ +import java.util.*; + +public class Main +{ + public static void main(String [] args) + { + Scanner Data = new Scanner(System.in); + + int n, a; + int sum; + + int N; + + N=Data.nextInt(); + + while(N!=0) + { + sum=0; + n=Data.nextInt(); + while(n!=0) + { + a=Data.nextInt(); + sum+=a; + n--; + } + System.out.printf("%d\n",sum); + N--; + } + } +} diff --git a/Java Experiments/A/A+B for Input-Output Practice (VI).java b/Java Experiments/A/A+B for Input-Output Practice (VI).java new file mode 100644 index 0000000..900b761 --- /dev/null +++ b/Java Experiments/A/A+B for Input-Output Practice (VI).java @@ -0,0 +1,25 @@ +import java.util.Scanner; + +public class Main +{ + public static void main(String [] args) + { + Scanner Data = new Scanner(System.in); + + int n, a; + int sum; + + while(Data.hasNextInt()) + { + sum=0; + n=Data.nextInt(); + while(n!=0) + { + a=Data.nextInt(); + sum+=a; + n--; + } + System.out.printf("%d\n",sum); + } + } +} diff --git a/Java Experiments/A/A+B for Input-Output Practice (VII).java b/Java Experiments/A/A+B for Input-Output Practice (VII).java new file mode 100644 index 0000000..9c6cf17 --- /dev/null +++ b/Java Experiments/A/A+B for Input-Output Practice (VII).java @@ -0,0 +1,19 @@ +import java.util.Scanner; + +public class Main +{ + public static void main(String [] args) + { + Scanner Data = new Scanner(System.in); + + int a,b; + + while(Data.hasNextInt()) + { + a=Data.nextInt(); + b=Data.nextInt(); + + System.out.printf("%d\n\n",a+b); + } + } +} \ No newline at end of file diff --git a/Java Experiments/A/A+B for Input-Output Practice.java b/Java Experiments/A/A+B for Input-Output Practice.java new file mode 100644 index 0000000..9830ca0 --- /dev/null +++ b/Java Experiments/A/A+B for Input-Output Practice.java @@ -0,0 +1,51 @@ +/* +Input +Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line +Output +For each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs. +Sample +Input +3 +4 1 2 3 4 +5 1 2 3 4 5 +3 1 2 3 +Output +10 + +15 + +6 + */ + +import java.util.Scanner; + +public class Main +{ + public static void main(String[] args) + { + Scanner in = new Scanner(System.in); + + int N; + N = in.nextInt(); + + int M; + int sum; + int t; + + while(N>0) + { + sum=0; + M=in.nextInt(); + while(M>0) + { + t=in.nextInt(); + sum+=t; + M--; + } + System.out.printf("%d\n\n",sum); + N--; + } + + + } +} \ No newline at end of file diff --git a/Java Experiments/A/Hello World!.java b/Java Experiments/A/Hello World!.java new file mode 100644 index 0000000..3d63fdb --- /dev/null +++ b/Java Experiments/A/Hello World!.java @@ -0,0 +1,7 @@ +public class Main +{ + public static void main(String [] args) + { + System.out.print("Hello World!\n"); + } +} \ No newline at end of file diff --git a/Java Experiments/A/格式化输出(常量练习).java b/Java Experiments/A/格式化输出(常量练习).java new file mode 100644 index 0000000..d781462 --- /dev/null +++ b/Java Experiments/A/格式化输出(常量练习).java @@ -0,0 +1,34 @@ +/* +Description +用c语言的基本输出格式打印下列内容: +100 +A +3.140000 + +Input +本题目没有输入数据 + +Output +输出三行数据: +100 +A +3.140000 + +Sample +Output +100 +A +3.140000 +*/ +public class Main +{ + public static void main(String [] args) + { + int a=100; + char c='A'; + double f=3.140000; + System.out.printf("%d\n",a); + System.out.printf("%c\n",c); + System.out.printf("%f\n",f); + } +} \ No newline at end of file diff --git a/Java Experiments/A/洗衣服.java b/Java Experiments/A/洗衣服.java new file mode 100644 index 0000000..125c1ca --- /dev/null +++ b/Java Experiments/A/洗衣服.java @@ -0,0 +1,31 @@ +/* +Description +X是一个勤劳的小孩,总是会帮助大人做家务。现在他想知道对于一根长为L的绳子能晾开多少件宽为W的衣服,显然这些衣服不能相互叠压。 +Input + 多组输入。 +每组输入两个整数L,W。 +Output + 输出答案。 +Sample +Input +10 5 +10 4 +Output +2 +2 + */ +import java.util.Scanner; +public class Main +{ + public static void main(String [] args) + { + Scanner in = new Scanner(System.in); + int L,W; + while(in.hasNextInt()) + { + L=in.nextInt(); + W=in.nextInt(); + System.out.printf("%d\n",L/W); + } + } +} \ No newline at end of file diff --git a/Java Experiments/A/火车.java b/Java Experiments/A/火车.java new file mode 100644 index 0000000..ca1412d --- /dev/null +++ b/Java Experiments/A/火车.java @@ -0,0 +1,31 @@ +import java.util.Scanner; + +public class Main +{ + public static void main(String [] args) + { + int T,n,a,b; + int max,temp; + Scanner in =new Scanner(System.in); + T=in.nextInt(); + + while(T!=0) + { + max=0; + temp=0; + n=in.nextInt(); + while(n!=0) + { + a=in.nextInt(); + b=in.nextInt(); + temp=temp-a+b; + if(max