【计算两点间的距离】 (C++代码)讲讲公式,讲讲流输出控制位数 摘要:解题思路: 两点之间的距离公式 sqrt(pow(x2-x1,2),pow(y2-y1,2));注意由于负数不好开根所以建议使用abs进行绝对值运算,核心公式一步修改为sqrt(pow(abs(…… 题解列表 2018年11月08日 1 点赞 2 评论 3139 浏览 评分:5.3
蓝桥杯算法提高VIP-欧拉函数 (C语言代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int t(int n){ int ans = n; for(int i = 2;i * i <= n;i ++) {…… 题解列表 2018年11月08日 1 点赞 0 评论 1232 浏览 评分:0.0
C语言训练-计算1~N之间所有奇数之和 (C语言代码)记得高中的等差数列吗 T=O(1) 摘要:解题思路:等差数列前n项和:(首项+末项)x (项数) /2 首项: 1 末项: N 或 N-1 (N为奇数时末项就为N,为偶数时末项就为N-…… 题解列表 2018年11月08日 2 点赞 0 评论 1267 浏览 评分:0.0
C语言训练-求函数值 (C语言代码)只能死板递归? 摘要:解题思路:虽然提交错误,但我也把代码贴出来;这里我处理了重叠子问题;提高了效率; 但是就是不通过。注意事项:参考代码:#include <cstdio> #include <cstring> #…… 题解列表 2018年11月07日 0 点赞 0 评论 779 浏览 评分:0.0
C语言训练-求函数值 (C语言代码)一行 摘要:解题思路:注意事项:参考代码:#include <cstdio> #include <cstring> #include <string> #include <cmath> #include …… 题解列表 2018年11月07日 0 点赞 0 评论 884 浏览 评分:0.0
C语言程序设计教程(第三版)课后习题5.5 (C语言代码) 摘要:解题思路:有惊吓注意事项:参考代码:#include<stdio.h>int main(){int x,y;scanf("%d",&x);if(x<1){ y=x;}if(1<=x&&x<…… 题解列表 2018年11月07日 1 点赞 0 评论 610 浏览 评分:0.0
C语言训练-斐波纳契数列 (C语言代码)DP 摘要:解题思路: 最后别递归(因为重复子问题太多了),除非你用记忆化递归 T = O(nlogn); & 题解列表 2018年11月07日 0 点赞 0 评论 1097 浏览 评分:0.0
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)太简洁了 O(n) 摘要:解题思路: 比如给定a=2,n=3:就是2+22+222 = 246; 题解列表 2018年11月07日 1 点赞 0 评论 916 浏览 评分:0.0
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)如此明了 摘要:解题思路:注意事项:参考代码:#include <cstdio> #include <cstring> #include <string> #include <cmath> #include …… 题解列表 2018年11月07日 0 点赞 0 评论 1342 浏览 评分:0.0
采药 (C语言代码)DP 摘要:解题思路:注意事项:参考代码:#include <cstdio> #include <cstring> #include <string> #include <cmath> #include …… 题解列表 2018年11月07日 0 点赞 0 评论 909 浏览 评分:0.0