1.A+B(https://www.acwing.com/problem/content/1/)
1 import java.util.Scanner;
2
3 public class Main{
4 public static void main(String [] args){
5 Scanner sc = new Scanner(System.in);
6 int a = sc.nextInt(), b = sc.nextInt();
7 System.out.println(a + b);
8
9 }
10 }
2.差(https://www.acwing.com/problem/content/610/)
1 import java.util.Scanner;
2 public class Main{
3 public static void main(String [] args) {
4 Scanner sc = new Scanner(System.in);
5 int a = sc.nextInt();
6 int b = sc.nextInt();
7 int c = sc.nextInt();
8 int d = sc.nextInt();
9 System.out.printf("DIFERENCA = %d",a*b-c*d);
10 }
11 }
3.两点间的距离(https://www.acwing.com/problem/content/618/)
1 import java.util.*;
2 public class Main{
3 public static void main(String[] args){
4 Scanner sc = new Scanner(System.in);
5 double x1 = sc.nextDouble(), y1 = sc.nextDouble(), x2 = sc.nextDouble(), y2 = sc.nextDouble();
6 System.out.printf("%.4f",Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
7 }
8 }
4.钞票(https://www.acwing.com/problem/content/655/)
import java.util.Scanner;
public class Main{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
System.out.println(x);
int y = x % 100;
int p = x;
System.out.printf("%d nota(s) de R$ 100,00\n", ((p - y)/100));
p = y;
y = y % 50;
System.out.printf("%d nota(s) de R$ 50,00\n", ((p - y)/50));
p = y;
y = y % 20;
System.out.printf("%d nota(s) de R$ 20,00\n", ((p - y)/20));
p = y;
y = y % 10;
System.out.printf("%d nota(s) de R$ 10,00\n", (( p - y)/10));
p = y;
y = y % 5;
System.out.printf("%d nota(s) de R$ 5,00\n", (( p - y)/5));
p = y;
y = y % 2;
System.out.printf("%d nota(s) de R$ 2,00\n", (( p - y)/2));
p = y;
y = y % 1;
System.out.printf("%d nota(s) de R$ 1,00\n", (( p - y)/1));
}
}
5.时间转换(https://www.acwing.com/problem/content/656/)
import java.util.Scanner;
public class Main{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = n/3600;
int b = n%3600/60;
int c = n%3600%60;
System.out.printf("%d:%d:%d",a,b,c);
}
}
6.倍数