
紫书
文章平均质量分 79
WE xiye
心有猛虎 细嗅蔷薇
展开
-
Yet Another Multiple Problem ( BFS还原 被除数(倍数))
题目链接 题目: uva 1653 题目大意: 给出一个数字n,和m个数字 要求求出在不含有 这m个数字的情况下,n的最小倍数 ! 思路 利用BFS 算法,模拟除法操作,还原出相应的倍数! 具体操作 起初在 BFS队列中 推入一个0,表示除法操作中的一次余数 根据模拟除法操作,余数会*10 + 被除数下一位的数字 组成一个新的被除数 如图 先用 8%7 会得到余数 1 余数 1会 *10 然后 加上 8 的下一位数字(0) 组成一个新的被除数 10 枚举答案 我们通过枚举 0-9的十个数字 一位一位的构原创 2021-11-18 17:40:00 · 371 阅读 · 1 评论 -
Circum Triangle(圆上三角形)
UVA 11186 题目大意:给出一个圆,在圆上有n个点,给出每个点的角度(相当于坐标) 求出每三个点围成的面积之和! 分析 给出点的数量是500,最简单的思路就是三层for循环直接枚举三个点然后求和 但是这样会超时,所以必须要想办法优化! 我们就要利用 所有的点,都在圆上这一信息! 图解 如果现在拿出三个点 i ,j ,k 组成一个三角形 那么 Sijk 有如下关系 那么就说明不管 k是在左边还是右边,都需要 减去Sijo 当k在中间时,则需要 加上 Sijo 所以我们可以对 所有的点 按照 弧度大小原创 2021-11-17 17:38:16 · 568 阅读 · 0 评论 -
紫书第7章-暴力dfs
暴力+dfsE-Krypton FactorL-Power Calculus E-Krypton Factor Description You have been employed by the organisers of a Super Krypton Factor Contest in which contestants have very high mental and physical abilities. In one section of the contest the contestants原创 2021-07-29 03:00:22 · 312 阅读 · 0 评论 -
紫书第6章 数据结构基础 例题(E-H)
数据结构基础 例题E-HH-TreeG-Trees on the levelF- Dropping BallsE-Self-Assembly H-Tree Description You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf原创 2021-07-25 01:08:48 · 3856 阅读 · 0 评论 -
第N个lunlun数!
定义: lunlun数:是一个所有相邻位数的差不超过1的整数 例如 1234 5678 454 343 321 54567 等等等 题目大意:现在给你一个整数 N,要求输出第 N个lunlun数 其中 N<=10000 分析:这个题如果使用暴力的做法枚举每一个数字,第10000个lunlun已经超过了10位,时间上卡不过去。 现在在这里分享一个AC的做法: 首先我们先大致找一下lunlun数的规律 如果 abc是一个3位lunlun数 如果 a取3,那么b只能取 2 3 4,然后再分别根据b取2 3原创 2021-06-13 02:24:40 · 498 阅读 · 0 评论 -
紫书:The Dole Queue
看起来简单,实际上一堆细节的一道题! Description In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided on the following strategy. Every day all dole applicants will be placed in a large circle, facing inwards. S原创 2021-05-22 15:25:59 · 176 阅读 · 0 评论