参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); String []week = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; //System.out.println(week[binEmod1(a, b, 7)]); System.out.println(week[binEmod2(a, b, 7)]); } public static int binEmod1(int a, int b, int m) { int res = 1; while(b > 0) { if((b & 1) == 1) res = res * a % m; a = a * a % m; b >>= 1; } return res; } public static int binEmod2(int a, int b, int m) { if(b == 0) return 1; int res = binEmod1(a, b >> 1, m); return ((b & 1) == 1) ? res * res * a % m : res * res % m; } }
0.0分
5 人评分
青年歌手大奖赛_评委会打分 (C语言代码)浏览:2153 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:580 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:582 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:452 |
交换Easy (C语言代码)浏览:1306 |
最长字符串 (C语言代码)浏览:793 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:1021 |
C语言训练-排序问题<1> (C语言代码)浏览:778 |
C语言训练-排序问题<2> (C语言代码)浏览:594 |
内部收益率 (C语言代码)浏览:1402 |