摘要: #include int memo[45]; int f(int n) { memo[2] = 1; memo[3] = 2; for(int i = 4; i <= n; ++ i) { memo[i] = memo[i - 1] + memo[i - 2]; } return memo[n]; } int main() { int n, m; scanf("... 阅读全文
posted @ 2019-08-01 17:11 青衫客36 阅读(91) 评论(0) 推荐(0) 编辑
摘要: #include int amicable(int n) { int sum = 0; for(int i = 1; i < n; ++ i) if(n % i == 0) sum += i; return sum; } int main() { int n, a, b, p, q; scanf("%d", &n); while(n --) { scanf("... 阅读全文
posted @ 2019-08-01 17:04 青衫客36 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 注意: 输入的边长可能是小数 阅读全文
posted @ 2019-08-01 16:53 青衫客36 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 程序在时间限制内没运行结束,就会出Output Limit Exceeded错误程序返回的结果是一直输出某个结果,死循环输出的那种 阅读全文
posted @ 2019-08-01 16:43 青衫客36 阅读(1035) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; typedef struct { int s; int e; }Ti; bool cmp(const Ti &a, const Ti &b) { return a.e = k.e) { k = t[i]; sum ++; } } printf("%d\n", sum)... 阅读全文
posted @ 2019-08-01 16:32 青衫客36 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 计算几何中计算三角形面积 在计算几何里,我们知道,△ABC的面积就是“向量AB”和“向量AC”两个向量叉积的绝对值的一半。其正负表示三角形顶点是在右手系还是左手系。 所以得到三角形面积 特别注意: 以上得到是有向面积(有正负)! 凸多边形的三角形剖分 很自然地,我们会想到以 P1为扇面中心,连接P1 阅读全文
posted @ 2019-08-01 16:01 青衫客36 阅读(4755) 评论(0) 推荐(0) 编辑
摘要: 多边形面积公式 如果逆时针给出点坐标,值为正, 如果顺时针给出点坐标,值为负。 包括凸凹多边形 实质为==第一个点与第二个点 第二个点与第三个点 一直到第n个点与第一个点的 叉乘 == 的和 阅读全文
posted @ 2019-08-01 15:50 青衫客36 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #include int main() { int a, b, c; while(scanf("%d %d", &a, &b) && (a != 0 || b != 0)) { c = 1; for(int i = 0; i < b; ++ i) { c = c * a % 1000; } printf("%d\n", c); } return 0;... 阅读全文
posted @ 2019-08-01 15:21 青衫客36 阅读(99) 评论(0) 推荐(0) 编辑