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.倍数(https://www.acwing.com/problem/content/667/)

复制代码
复制代码
import java.util.Scanner;
public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a%b==0 || b%a==0){
            System.out.println("Sao Multiplos");
        }else{
            System.out.println("Nao sao Multiplos");
        }
    }
}
复制代码
复制代码

7.零食(https://www.acwing.com/problem/content/662/)

复制代码
复制代码
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double x = sc.nextInt(), y = sc.nextInt();
        if(x == 1){
            System.out.printf("Total: R$ %.2f",y*4);
        }
        else if(x == 2){
            System.out.printf("Total: R$ %.2f",y*4.5);
        }
         else if(x == 3){
            System.out.printf("Total: R$ %.2f",y*5);
        }
         else if(x == 4){
            System.out.printf("Total: R$ %.2f",y*2);
        }
         else if(x == 5){
            System.out.printf("Total: R$ %.2f",y*1.5);
        }
    }
}
复制代码
复制代码

8.区间(https://www.acwing.com/problem/content/661/)

复制代码
复制代码
import java.util.Scanner;
public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        if(a < 0 || a > 100){
            System.out.println("Fora de intervalo");
        }
        else{
            if(a >= 0 && a <= 25)System.out.printf("Intervalo [0,25]");
            else if(a > 25 && a <= 50)System.out.printf("Intervalo (25,50]");
            else if(a > 50 && a <= 75)System.out.printf("Intervalo (50,75]");
            else if(a > 75 && a <= 100)System.out.printf("Intervalo (75,100]");
            
        }
    }
}
复制代码
复制代码

 

9.游戏时间(https://www.acwing.com/problem/content/669/)

复制代码
复制代码
import java.util.Scanner;
public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int m = 0;
       if(a>b) m = 24 - a + b;
       else if(a == b) m = 24;
       else if(a < b) m = b - a;

       
        System.out.printf("O JOGO DUROU %d HORA(S)",m);
        
    }
}
复制代码
复制代码

10.动物(https://www.acwing.com/problem/content/672/)

复制代码
复制代码
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = new String();
        String[] a = new String[3];
        for(int i=0 ; i< 3;i ++){
            a[i] = sc.next();
            s += a[i].charAt(0);
        }
        if(s.equals("vac"))System.out.println("aguia");
        if(s.equals("vao"))System.out.println("pomba");
        if(s.equals("vmo"))System.out.println("homem");
        if(s.equals("vmh"))System.out.println("vaca");
        if(s.equals("iih")){
            if(a[2].equals("hematofago")){
                System.out.println("pulga");
            }
            else{
                System.out.println("lagarta");
            }
        }
        if(s.equals("iah"))System.out.println("sanguessuga");
        if(s.equals("iao"))System.out.println("minhoca");
    }
}
复制代码
复制代码