This commit is contained in:
KYOSG 2021-05-08 19:13:12 +08:00
parent 0538cee955
commit d06c8eb809
16 changed files with 342 additions and 0 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
Java Experiments/.DS_Store vendored Normal file

Binary file not shown.

BIN
Java Experiments/A/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -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();
}
}

View File

@ -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);
}
}
}

View File

@ -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--;
}
}
}

View File

@ -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);
}
}
}

View File

@ -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--;
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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--;
}
}
}

View File

@ -0,0 +1,7 @@
public class Main
{
public static void main(String [] args)
{
System.out.print("Hello World!\n");
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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<temp)
max=temp;
n--;
}
System.out.println(max);
System.out.println();
T--;
}
}
}

View File

@ -0,0 +1,34 @@
/*
Description
输入一个三位正整数将它反向输出
Input
3位正整数
Output
逆置后的正整数
Sample
Input
123
Output
321
Hint
注意130逆置后是31
*/
import java.util.Scanner;
public class Main
{
public static void main(String [] args)
{
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int a=n/100;
int b=n/10-a*10;
int c=n-a*100-b*10;
int d=c*100+b*10+a;
System.out.printf("%d\n",d);
}
}