解题思路:
注意事项:
参考代码
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
int item = 1;
for (int i = 1;i<=b; i++) {
item = (item*a)%7;
}
switch ((int)(item) % 7) {
case 1:
System.out.println("Monday");
break;
case 2:
System.out.println("Tuesday");
break;
case 3:
System.out.println("Wednesday");
break;
case 4:
System.out.println("Thursday");
break;
case 5:
System.out.println("Friday");
break;
case 6:
System.out.println("Saturday");
break;
default:
System.out.println("Sunday");
break;
}
0.0分
1 人评分