stl map

hnjzsyjyj11 天前
dfs·stl map·字符索引数组
洛谷 P1305:新二叉树 ← DFS + 字符索引数组 + map【题目来源】 https://www.luogu.com.cn/problem/P1305 【题目描述】 输入一串二叉树,输出其前序遍历。 【输入格式】 第一行为二叉树的节点数 n。(1≤n≤26) 后面 n 行,第一个字母为节点,后两个字母分别为其左右儿子。特别地,数据保证第一行读入的节点必为根节点。 空节点用 * 表示。 【输出格式】 二叉树的前序遍历。 【输入样例】 6 abc bdi cj* d** i** j** 【输出样例】 abdicj 【数据范围】 1≤n≤26 【算法分析】 ● 字符可以
hnjzsyjyj6 个月前
数据结构·stl map
洛谷 B4241:[海淀区小学组 2025] 统计数对 ← STL map【题目来源】 https://www.luogu.com.cn/problem/B4241 【题目描述】 陶陶是一个计算机爱好者,对二进制数有着特别的喜好,遇到各种各样的数据,他总能找到跟 2 的整数次幂的关系。现在,他获得了一个长度为 n 的数列 a1,a2,…,an,他发现其中有些元素的和恰好是 2 的整数次幂。对于给定的 a1,a2,…,an,你的任务是统计有多少个数对 (i,j) 满足 ai+aj=2^x,其中 x∈N∗,i<j,这里 N∗ 表示正整数集合。 【输入格式】 第一行包含一个整数 n,
hnjzsyjyj3 年前
stl map
HDU 2648:Shopping ← STL map【题目来源】 http://acm.hdu.edu.cn/showproblem.php?pid=2648 【题目描述】 Every girl likes shopping,so does dandelion.Now she finds the shop is increasing the price every day because the Spring Festival is coming .She is fond of a shop which is called "memory". Now sh
我是有底线的