摘要: https://www.acwing.com/problem/content/1243/ 稍复杂一些的模拟题,但是若是暴力做法即将a[i][j]定义为i时刻id为j的优先级即可双重循环枚举每个时刻,每个id所有组合在此情况下再判断这样的a[i][j]是否满足进入优先缓存st[i]中,a[i][j]进 阅读全文
posted @ 2022-10-13 21:26 风乐 阅读(42) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/1233/ 简简单单小模拟要注意的是,这题有点类似于脑筋急转弯,需要仔细分析题意,带入假设量计算得出即可并且此题输入有点毒,可以用getline读入一行,再从string中一个一个的抠出来变量,也可用格式输入 #inclu 阅读全文
posted @ 2022-10-12 23:58 风乐 阅读(19) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/description/1231/ 蒟蒻只会暴力而Y总的思路就特牛,直接从日起开始枚举,只需判断日期是否合法即可输出 #include <cstdio> #include <iostream> using namespac 阅读全文
posted @ 2022-10-11 11:11 风乐 阅读(23) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/description/15/ 显然此题可以用桶法做,空间换时间 class Solution { public: int duplicateInArray(vector<int>& nums) { int a[1005] 阅读全文
posted @ 2022-10-10 16:28 风乐 阅读(25) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/1221/ 根据样例,模拟一下得出规律即n/w的值决定n所在的行数是正向还是反向n/2为偶,则为正,为奇,则为反对于一个数,它的位置表示可以用,行:行/w,列:列%w细节点1:但是,对于边界值却不好处理例如:1 2 3 4 阅读全文
posted @ 2022-10-09 20:32 风乐 阅读(43) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/description/790/ y总的思路我的理解究其分治,底层原理,大概是:利用归并排序的分治特点,一次分两组最终分成单位为1,即只有1个数的组即第1,第2中情况都被分成了第三种情况由于只有1个数.即每个序列都有序,可 阅读全文
posted @ 2022-10-08 12:12 风乐 阅读(22) 评论(0) 推荐(0)
摘要: 力扣链接:剑指 Offer 03. 数组中重复的数字 acwing链接 最初的思路是,将所有数据放入桶中,数据存在,数据桶值就++,有数据重复就retrun nums[i],无数据重复就return -1,且需要考虑优先输出-1,其次才是重复值nums[i],因此我最初在acwing上的代码为: c 阅读全文
posted @ 2022-10-07 23:10 风乐 阅读(20) 评论(0) 推荐(0)
摘要: 上传文件流程图,要点都在图上 阅读全文
posted @ 2022-10-07 15:33 风乐 阅读(59) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/468/ 模拟题,洛谷也有一道 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace s 阅读全文
posted @ 2022-10-05 14:59 风乐 阅读(17) 评论(0) 推荐(0)
摘要: #include<iostream> #include<sstream> using namespace std; int a[1000]; int cnt,n; int main() { cin >> cnt; string line; getline(cin,line);//cin会被回车,空格 阅读全文
posted @ 2022-10-05 13:58 风乐 阅读(31) 评论(0) 推荐(0)