摘要: 思路: 运用快速幂。 代码: 总结: 需要防止溢出。 a^b 求个位的数字 中需要除以10,至于其他题目看题目要求。 每个数都除以10是为了防止溢出 这里的mod个人理解为是大部分按照题目要求需要除以的数,为了防止溢出。 阅读全文
posted @ 2019-07-17 22:52 question-maker 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 思路: 运用初中知识 题解: #include <iostream>#include <stdio.h>#include <math.h>using namespace std;double PI = acos(-1.0);int main(){ int a; while (cin >> a) { 阅读全文
posted @ 2019-07-13 12:55 question-maker 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 思路: 。。。也没什么好讲的 解题: #include <iostream>using namespace std; #define N 1000000 int chara[N]; int main(){ long long a; cin >> a; if (a > 1) cout << "Shi" 阅读全文
posted @ 2019-07-13 12:49 question-maker 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 思路: 从1和2开始相加和后面的数依次比较,如果比它们的和大就舍去,小的话就将两个数字中较小的数进行替换。 1+2 = 3, 2 + 3 > 4, 舍去4, 2 + 3 = 5, 3 + 5 > 6, 舍去6 依次类推。 解题 #include <string.h> #include <iostre 阅读全文
posted @ 2019-07-10 23:18 question-maker 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 思路: 用结构体捆绑两个村庄和其间的距离 使用并查集和最小生成树,此处采用kruskal算法求最小生成树. 代码: #include <stdio.h> int fa[10000]; void init(int m) { for (int i = 1; i <= m; i++ ) fa[i] = i 阅读全文
posted @ 2019-07-09 16:25 question-maker 阅读(264) 评论(0) 推荐(0) 编辑