Stay Hungry,Stay Foolish!

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 24 下一页
摘要: P1015 [NOIP1999 普及组] 回文数 https://www.luogu.com.cn/problem/P1015 思路 将字符串m转换为10进制的值 翻转m,也转换为10进制值, 后运用10进制加这两个数 转换为对应进制n的字符串, 判断是否为回文 Code -- Partial AC 阅读全文
posted @ 2023-02-11 15:54 lightsong 阅读(112) 评论(0) 推荐(0) 编辑
摘要: A. One and Two https://codeforces.com/problemset/problem/1788/A 思路 统计2的个数, 如果是奇数个, 不满足 如果是偶数个, 2队列中,前半部分最后一个2则为目标位置 如果个数是0, 即都是1的情况, 则k=1 Code https:/ 阅读全文
posted @ 2023-02-11 11:04 lightsong 阅读(14) 评论(0) 推荐(0) 编辑
摘要: B. Sum of Two Numbers https://codeforces.com/problemset/problem/1788/B 思路 计算原数的所有位置上的digit和 得到digit和的一半 对于原数从左到右切分,前半部分digit和为half 例如: 1331 -->> 1300 阅读全文
posted @ 2023-02-11 11:00 lightsong 阅读(30) 评论(0) 推荐(0) 编辑
摘要: P1002 [NOIP2002 普及组] 过河卒 https://www.luogu.com.cn/problem/P1002 思路 初始设置 0 行 0列的点 取值为1,表示有一条路径到达此目标点, 注意当遇到第一个障碍点, 停止赋值 然后对 1-n 行 1-m列 做dp计算 按照如下公式: dp 阅读全文
posted @ 2023-02-10 18:21 lightsong 阅读(33) 评论(0) 推荐(0) 编辑
摘要: B. Solitaire https://codeforces.com/problemset/problem/208/B 思路 dfs+回溯 对两种操作情况进行 地毯式搜索, 找到可能的一种方法。 Note: 需要使用cache对已经搜索过的路径的结果,做记录, 减少重复计算。参考: https:/ 阅读全文
posted @ 2023-02-10 00:04 lightsong 阅读(14) 评论(0) 推荐(0) 编辑
摘要: D - Pair of Balls https://atcoder.jp/contests/abc216/tasks/abc216_d 思路 m个桶, n个颜色, 第一轮遍历所有桶的最上面球的颜色, 将相同颜色的球所在队列, 计入 color节点, 即是说,存在两个桶的最上面的两个球颜色相同, 例如 阅读全文
posted @ 2023-02-08 22:25 lightsong 阅读(20) 评论(0) 推荐(0) 编辑
摘要: D - Restricted Permutation https://atcoder.jp/contests/abc223/tasks/abc223_d 思路 https://zhuanlan.zhihu.com/p/135094687 利用拓扑排序方法, 先找入度为0的点,建立优先队列,包括: 2 阅读全文
posted @ 2023-02-06 23:03 lightsong 阅读(12) 评论(0) 推荐(0) 编辑
摘要: C - Don’t be cycle https://atcoder.jp/contests/abc288/tasks/abc288_c 思路 检测出最小环有几个, 然后破掉相同数目的边即可。 检测最小环数目方法: Code https://atcoder.jp/contests/abc288/su 阅读全文
posted @ 2023-02-05 00:56 lightsong 阅读(51) 评论(0) 推荐(0) 编辑
摘要: E - Yutori https://atcoder.jp/contests/abc161/tasks/abc161_e 思路 https://blog.csdn.net/weixin_45750972/article/details/105325285 两种贪心策略: 从左边尽早完成任务; 从右边 阅读全文
posted @ 2023-02-04 19:06 lightsong 阅读(17) 评论(0) 推荐(0) 编辑
摘要: D - Match or Not https://atcoder.jp/contests/abc287/tasks/abc287_d 思路 https://www.acwing.com/solution/content/166180/ 对于t,分成两个段, 前段在s和t的最大前缀找, 后端在s和t的 阅读全文
posted @ 2023-02-04 11:56 lightsong 阅读(11) 评论(0) 推荐(0) 编辑
摘要: D - Takahashi Tour https://atcoder.jp/contests/abc213/tasks/abc213_d 思路 图数据结构存储边的关系。 DFS遍历, 对于相邻节点存储使用set。 Code https://atcoder.jp/contests/abc213/sub 阅读全文
posted @ 2023-02-03 21:51 lightsong 阅读(31) 评论(0) 推荐(0) 编辑
摘要: C - Path Graph https://atcoder.jp/contests/abc287/tasks/abc287_c 思路 判断所有点组成一个链的路径 根据每个节点的度来判断: 链路的度: 两边为节点度为1, 中间所有节点度为2. 1 -- 2 -- 2 -- ... -- 2 -- 1 阅读全文
posted @ 2023-01-29 23:28 lightsong 阅读(34) 评论(0) 推荐(0) 编辑
摘要: E - Bishop 2 https://atcoder.jp/contests/abc246/tasks/abc246_e 思想 BFS遍历。 Code https://atcoder.jp/contests/abc246/submissions/38443616 bool pts[1505][1 阅读全文
posted @ 2023-01-29 23:20 lightsong 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Deploying from a Git Tag -- buildingTag https://notesfromthelifeboat.com/post/deploying-from-a-git-tag/ If you want to evaluate your changes in the st 阅读全文
posted @ 2023-01-24 23:11 lightsong 阅读(12) 评论(0) 推荐(0) 编辑
摘要: B - New Place https://atcoder.jp/contests/arc154/tasks/arc154_b 思路 https://blog.csdn.net/nike0good/article/details/128751025 由于操作的特殊性,从s的第一个字符删除,插入后面任 阅读全文
posted @ 2023-01-23 20:17 lightsong 阅读(36) 评论(0) 推荐(0) 编辑
摘要: A - Swap Digit https://atcoder.jp/contests/arc154/tasks/arc154_a 思路 A 和 B中数字需要互换, 互换的准则是,使得 互换后的 AB 乘积最小, 互换后的 A 和 B 差值尽量大 即: 将对应位置的 数字, 小的数字放在A, 大的数字 阅读全文
posted @ 2023-01-23 18:28 lightsong 阅读(40) 评论(0) 推荐(0) 编辑
摘要: E - Souvenir https://atcoder.jp/contests/abc286/tasks/abc286_e 思想 图计算Floyd算法,求任意两点之间的最短距离 最短距离对应路径上value总和。 Floyd算法理解 https://www.cnblogs.com/lightson 阅读全文
posted @ 2023-01-22 23:54 lightsong 阅读(24) 评论(0) 推荐(0) 编辑
摘要: D - Money in Hand https://atcoder.jp/contests/abc286/tasks/abc286_d 思路 参考:https://www.geeksforgeeks.org/coin-change-dp-7/ dp[i][j]: for j yuan, find i 阅读全文
posted @ 2023-01-22 22:30 lightsong 阅读(18) 评论(0) 推荐(0) 编辑
摘要: D - Money in Hand https://atcoder.jp/contests/abc286/tasks/abc286_d 思路 -- 可达性标记法 创建可达性标记map vis 默认设置 vis[0] = true 表示 0 的钱数,可以凑成,不用选取任何硬币 对于 A1 B1 做可访 阅读全文
posted @ 2023-01-22 14:00 lightsong 阅读(36) 评论(0) 推荐(0) 编辑
摘要: C - Rotate and Palindrome https://atcoder.jp/contests/abc286/tasks/abc286_c 思路 从原始字符串开始, rotate第一次, rotate第二次, ... , rotate最后一次 对于每种情况得到的字符串: 判断如果转换成回 阅读全文
posted @ 2023-01-22 13:38 lightsong 阅读(43) 评论(0) 推荐(0) 编辑
摘要: C - abc285_brutmhyhiizp https://atcoder.jp/contests/abc285/tasks/abc285_c 思路 对于长度为L+1的字符序列, A[1], ..., A[L], A[L+1] 首先统计长度为1 到 L 字符序列 总数, 即 A , ... , 阅读全文
posted @ 2023-01-20 13:06 lightsong 阅读(19) 评论(0) 推荐(0) 编辑
摘要: D - Change Usernames https://atcoder.jp/contests/abc285/tasks/abc285_d 思路 DFS深度遍历图。 需要注意的是, 整个大图中可能有很多小的连通子图, 每个子图需要确定起始访问节点,起始节点为没有入度的节点。 同时还需要注意的是, 阅读全文
posted @ 2023-01-20 12:59 lightsong 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 1032. Find a Multiple https://acm.timus.ru/problem.aspx?space=1&num=1032 思路 对于n个数 a[1] ... a[n] 首先计算累加和 s[1] ... s[n] s[i] = a[1] + a[2] + ... + a[i] 阅读全文
posted @ 2023-01-10 22:35 lightsong 阅读(16) 评论(0) 推荐(0) 编辑
摘要: B. Kolya and Tandem Repeat https://codeforces.com/problemset/problem/443/B 思路 如果补充字符长度k大于等于s长度,则新的字符串,一份两半, 前半分包括s,可能包括部分补充的字符, 后半部分,则是完全的补充字符,可以完全匹配前 阅读全文
posted @ 2023-01-08 23:22 lightsong 阅读(30) 评论(0) 推荐(0) 编辑
摘要: C - Count Connected Components https://atcoder.jp/contests/abc284/tasks/abc284_c 思路 寻找独立的子连通图个数。 使用map记录边,即点之间的连通性 使用vector记录顶点是否被访问过 使用queue对任意未访问点做b 阅读全文
posted @ 2023-01-08 18:01 lightsong 阅读(32) 评论(0) 推荐(0) 编辑
摘要: E - Don't Isolate Elements https://atcoder.jp/contests/abc283/tasks/abc283_e 思路 参考 https://www.cnblogs.com/cilinmengye/p/17008799.html 阅读全文
posted @ 2023-01-07 19:55 lightsong 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 1055. Combinations https://acm.timus.ru/problem.aspx?space=1&num=1055 思路 对于组合数 C(M,N) 不能使用公式计算最终值,然后再根据最终值,分解质因数,统计质因数个数; 因为这种情况会导致数值越界。 改变思路, 组合数公式实际 阅读全文
posted @ 2023-01-03 15:34 lightsong 阅读(14) 评论(0) 推荐(0) 编辑
摘要: F - Permutation Distance https://atcoder.jp/contests/abc283/tasks/abc283_f 思路 最小生成树法: https://zhuanlan.zhihu.com/p/595421879 动态缩减查找距离法 朴素思维: 如果按照Di定义, 阅读全文
posted @ 2023-01-03 12:20 lightsong 阅读(38) 评论(0) 推荐(0) 编辑
摘要: D - Scope https://atcoder.jp/contests/abc283/tasks/abc283_d 思路 使用stack做字符串的内容分析, 除了)所有的字符依次入栈, 遇到(字符,则从栈顶开始依次出栈,直到第一个(也被出栈; 使用set做已入栈的小写字母统计, 在小写字母入栈过 阅读全文
posted @ 2023-01-01 22:53 lightsong 阅读(45) 评论(0) 推荐(0) 编辑
摘要: C. On Number of Decompositions into Multipliers https://codeforces.com/problemset/problem/397/C 思路 Code https://codeforces.com/contest/397/submission/ 阅读全文
posted @ 2023-01-01 22:46 lightsong 阅读(15) 评论(0) 推荐(0) 编辑
摘要: D - Make Bipartite 2 https://atcoder.jp/contests/abc282/tasks/abc282_d Simple Graph https://mathworld.wolfram.com/SimpleGraph.html A simple graph, als 阅读全文
posted @ 2022-12-18 00:50 lightsong 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Median http://poj.org/problem?id=3579 思路 参考: https://www.cnblogs.com/sky-stars/p/11317030.html lower_bound http://c.biancheng.net/view/7521.html 阅读全文
posted @ 2022-12-12 21:14 lightsong 阅读(73) 评论(0) 推荐(0) 编辑
摘要: Floyd算法 dijistra算法解决,从一点出发,到其它所有点的最短路径。 此算法解决,从任何一点出发,到任何点的最短路径。 https://zhuanlan.zhihu.com/p/87480486 理解 阅读全文
posted @ 2022-12-11 23:40 lightsong 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1053. Pinocchio https://acm.timus.ru/problem.aspx?space=1&num=1053 思路 每次取两个,进行比较, 相等则舍去一个, 不相等,则从长的里面减去短的。 对于不相等的情况, 则相当于将长的中多减几次短的,直到不能减为止,这就相当于求最大公约 阅读全文
posted @ 2022-12-10 15:33 lightsong 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 1236. Decoding Task https://acm.timus.ru/problem.aspx?space=1&num=1236 思路 对于带空格串加密结果,第一个字符61,K1K2 XOR 32 = 61,可以算出K1K2 对于原始串加密结果,第一个字符05, K1K2 XOR C1C 阅读全文
posted @ 2022-12-10 14:45 lightsong 阅读(19) 评论(0) 推荐(0) 编辑
摘要: D - Factorial and Multiple https://atcoder.jp/contests/abc280/tasks/abc280_d 思路 Code https://blog.csdn.net/wp_fxy/article/details/128179159 https://ww 阅读全文
posted @ 2022-12-07 10:21 lightsong 阅读(63) 评论(0) 推荐(0) 编辑
摘要: E - Critical Hit https://atcoder.jp/contests/abc280/tasks/abc280_e REFERENCE https://blog.csdn.net/sophilex/article/details/128169335 dp[i]=(dp[i-2]+1 阅读全文
posted @ 2022-12-05 23:26 lightsong 阅读(50) 评论(0) 推荐(0) 编辑
摘要: Q Learning 升级版 https://zhuanlan.zhihu.com/p/110657606 Q Learning面向的是离散状态空间, DQN可以面向连续状态空间。 Sample Code https://github.com/louisnino/RLcode/blob/master 阅读全文
posted @ 2022-12-01 15:28 lightsong 阅读(255) 评论(0) 推荐(0) 编辑
摘要: D - Freefall https://atcoder.jp/contests/abc279/tasks/abc279_d 思路 求凹函数的极小值 https://www.cnblogs.com/luoyj/p/12408277.html#6 #include<bits/stdc++.h> usi 阅读全文
posted @ 2022-11-27 22:34 lightsong 阅读(96) 评论(0) 推荐(0) 编辑
摘要: E - Crystal Switches https://atcoder.jp/contests/abc277/tasks/abc277_e 思路 做双层图分离。 使用虚线连接两个图,表示switch动作。 使用双端队列,结合最短路算法,从1出发,遍历所有节点。 取两个目标节点路径更小值。 Code 阅读全文
posted @ 2022-11-19 12:07 lightsong 阅读(39) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 24 下一页
Life Is Short, We Need Ship To Travel