题目一:倍数
665. 倍数 - AcWing题库
代码
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();
if(a%b==0 || b%a==0)
System.out.printf("Sao Multiplos\n");
else
System.out.printf("Nao sao Multiplos\n");
}
}
题目二:零食
660. 零食 - AcWing题库
代码
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt(), y = sc.nextInt();
double p = 0;
if(x == 1) p = 4;
else if(x == 2) p = 4.5;
else if(x == 3) p = 5;
else if(x == 4) p = 2;
else if(x == 5) p = 1.5;
System.out.printf("Total: R$ %.2f\n",y*p);
}
}