随笔分类 -  洛谷

上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
洛谷中出现的知识总结、题解等
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; double dis(double x1, double y1, double x2, double y2) { return sqrt((x2 - x1) * (x2 - x1) + (y2 - 阅读全文
posted @ 2021-11-19 08:56 糖豆爸爸 阅读(166) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int a[3]; char s1, s2; int main() { //充分利用c++语言优势 while (scanf("%c:=%c;", &s1, &s2) == 2) //赋值语句简洁 阅读全文
posted @ 2021-11-18 10:59 糖豆爸爸 阅读(128) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; string a; string b; int main() { cin >> a >> b; int sum1 = 1; for (int i = 0; i < a.size(); i++) su 阅读全文
posted @ 2021-11-18 10:42 糖豆爸爸 阅读(61) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; //原始英文数字 // You are a three eight pig . 10964 unordered_map<string, int> _map = {{"zero", 0}, {"one 阅读全文
posted @ 2021-11-18 10:38 糖豆爸爸 阅读(115) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; const int N = 25; int a[N][N][N]; int main() { int w, x, h, q; cin >> w >> x >> h >> q; int x1, y1, z1, 阅读全文
posted @ 2021-11-10 15:19 糖豆爸爸 阅读(64) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; const int N = 1010; int a[N][5];//二维的最后一个位置,装总分 int n; int cnt; int main() { cin >> n; for (int i = 1; i 阅读全文
posted @ 2021-11-10 15:13 糖豆爸爸 阅读(201) 评论(0) 推荐(0) 编辑
摘要:重点: 用数组记数,大于0的就表示被移走了,等于0的没动过。 #include <bits/stdc++.h> using namespace std; const int N = 10010; int b[N]; int l; int m; //区域的数目 int u, v; //表示一个 阅读全文
posted @ 2021-11-10 15:10 糖豆爸爸 阅读(104) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; const int N = 210; int a[N], cnt; int n; int main() { cin >> n; while (n > 1) { a[cnt++] = n; if (n % 2 阅读全文
posted @ 2021-11-10 15:05 糖豆爸爸 阅读(121) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; const int N = 110; int a[N]; int main() { int idx; //数字0时终止输入 for (idx = 0;; idx++) { cin >> a[idx 阅读全文
posted @ 2021-11-10 14:42 糖豆爸爸 阅读(54) 评论(0) 推荐(0) 编辑
摘要:题目传送门 重点: 使用数组为每条小鱼记数。 #include <bits/stdc++.h> using namespace std; const int N = 110; int a[N], b[N], n; int main() { cin >> n; //每一条小鱼的可爱值 for (int 阅读全文
posted @ 2021-11-10 13:46 糖豆爸爸 阅读(224) 评论(0) 推荐(0) 编辑
摘要:第一部分 语言入门 第一章 简简单单写程序 例 1-11 评测机队列 第二章 顺序结构程序设计 例题 P5703 红 例5 P5704 红 例6 P5705 红 例71 P5706 红 例8 P1425 红 例10 P3954 红 例11(NOIP 2017 PJ T1) P5707 橙 例12 习 阅读全文
posted @ 2021-11-10 13:36 糖豆爸爸 阅读(2907) 评论(1) 推荐(1) 编辑
摘要:奶牛的发型 题目传送门 一、理解和感悟 1、号码和值都是非常重要的,不要只记录值,用一个数组a[i]来保存值,号码就是i。 2、每头牛都是在找到了右侧比自己高的牛时,记录右侧第一个比自己高的牛。 3、最终统计时有两种情况,一种是找到了右侧比自己高的牛,另一种是没有找到右侧比自己高的牛。 4、 阅读全文
posted @ 2021-09-13 13:46 糖豆爸爸 阅读(37) 评论(0) 推荐(0) 编辑
摘要:题目传送门 一、解题思路 1、又能向左发射,又能向右发射,不太好想。复杂问题都是由简单问题组装而来,我们先来考虑这个问题的一半。假如每个发射站只会向左发射信号,如果第i个发射塔比它左边的发射站都高,那么第i个发射站左边的站点就不可能收到i站点及i站后面所有站点发送来的信号,因为就算有 阅读全文
posted @ 2021-09-10 08:47 糖豆爸爸 阅读(82) 评论(0) 推荐(0) 编辑
摘要:AcWing题目传送门 洛谷题目传送门 一、题目描述 约翰有N头奶牛,编号为1N。 现在这N头奶牛按编号从小到大的顺序站成了一排,其中奶牛 i 的身高为Hi。 现在,每头奶牛都向它的右侧望向那些编号较大的奶牛,对于奶牛 i 如果存在一头奶牛 j 满足 阅读全文
posted @ 2021-09-09 17:02 糖豆爸爸 阅读(110) 评论(0) 推荐(0) 编辑
摘要:题目传送门 一、前导知识 欧拉函数与筛法求欧拉函数 二、朴素思路 我们先不管数据范围是不是1012,先思考就朴素的作法是什么样的: qiandao(x)=xϕ(x) ,假设x在我们可控的数据范围内,就是筛出数据范围内的ϕ(x), 然后利用公式计算一下sum和,再$mo 阅读全文
posted @ 2021-09-01 10:49 糖豆爸爸 阅读(90) 评论(0) 推荐(2) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; typedef long long LL; LL x, y, ans; //辗转相除法 LL gcd(LL a, LL b) { if (b == 0) return a; ans += 4 * 阅读全文
posted @ 2021-08-31 16:37 糖豆爸爸 阅读(30) 评论(0) 推荐(0) 编辑
摘要:题目传送门 一、解题思路 这道题有些意思,因为a肯定是分子,怎么想办法也不可能变成分母。b肯定是分母,怎么的也变不成分子。c,d,e,f...就是有可能是分子,也有可能是分母,尽量想办法让它们全是分子,这样出现整数的概率高,出现在分母,还得想办法去约分掉它,麻烦。(贪心) 那它们是否真的 阅读全文
posted @ 2021-08-31 16:15 糖豆爸爸 阅读(88) 评论(0) 推荐(0) 编辑
摘要:题目传送门 一、准备知识 求一个数x的所有约数 #include <bits/stdc++.h> using namespace std; const int N = 1010; int c[N]; /** * 功能:获取指定数x的所有约数 * @param x */ void ys(int x) 阅读全文
posted @ 2021-08-31 14:34 糖豆爸爸 阅读(65) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; typedef long long LL; LL a, b, c; LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; } LL lcm(LL x 阅读全文
posted @ 2021-08-31 10:53 糖豆爸爸 阅读(40) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int a, b, c, d; /** 测试用例: 2/1+1/3-1/4 答案:25/12 -2/1+1/3-1/4 答案:-23/12 测试点6 7/4+1/3+8/5-3/2-6/9-6/4 阅读全文
posted @ 2021-08-31 10:47 糖豆爸爸 阅读(69) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
Live2D
点击右上角即可分享
微信分享提示