Loading

摘要: 1 int gcd(int a, int b) 2 { 3 return b == 0 ? a : gcd(b, a%b); 4 } 5 6 int lcm(int a, int b) 7 { 8 return a * (b/gcd(a, b)); // 建议先除再乘,避免乘法溢出 9 } 阅读全文
posted @ 2019-09-08 15:17 拾月凄辰 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-09-08 15:14 拾月凄辰 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 10 using namespace std; 11 12 #define maxn 15 13 int n, k; 14 struct matrix//定义一个结构体,方便传递值 15... 阅读全文
posted @ 2019-09-08 15:12 拾月凄辰 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 1 #define maxn 15 2 3 int n, k; // n阶方阵的k次幂 4 5 struct matrix//定义一个结构体,方便传递值 6 { 7 int m[maxn][maxn]; 8 }; 9 10 /* 11 mod由全局定义,mod根据需要可以省去 12 */ 13 14 matrix mul(matrix a, matrix b) //矩阵求积, 矩阵乘法 15 { 阅读全文
posted @ 2019-09-08 15:01 拾月凄辰 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 1 int quick_pow(int a, int b) // 二分求幂 2 { 3 int ans = 1; 4 while(b != 0) 5 { 6 if(b % 2 == 1) 7 ans *= a; 8 a *= a; 9 b >>= 1; 10 } 11 return ans; 12 阅读全文
posted @ 2019-09-08 11:17 拾月凄辰 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 问题描述 试题编号: 201803-3 试题名称: URL映射 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 URL 映射是诸如 Django、Ruby on Rails 等网页框架 (web frameworks) 的一个重要组件。对于从浏览器发来的 HTTP 请求,UR 阅读全文
posted @ 2019-09-08 08:34 拾月凄辰 阅读(473) 评论(0) 推荐(0) 编辑