上一页 1 ··· 6 7 8 9 10 11 12 下一页
摘要: poj3321 Apple Tree dfs序 + 树状数组 POJ - 3321 题意: 一棵树,每棵树的初始权值为1,现在有两个操作 1. "C x" 改变节点x的权值,1变0,0变1 2."Q x"询问以x为根节点的子树的权值和 题解: 通过dfs序将树上问题转化为区间问题,通过树状数组维护权 阅读全文
posted @ 2020-09-14 16:07 hulian425 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 省赛预选赛 A - Bingo Ties 题意 : 给你多个卡片,然后裁判报数,当某个时刻,某个卡片的其中一行都被报到了,则喊bingo。当两张卡片能够同时喊bingo, 则输出这两张卡片的编号,如果有多种情况,则输出字典序最小的 若不能两个同时喊bingo,则输出“no ties”; 题解: 暴力 阅读全文
posted @ 2020-09-13 19:55 hulian425 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 3.55 can't be represented exactly in floating point. The internal value is something like 3.54999999999, which rounds to 3.5 首先要明白浮点数在计算机中都绝大多数是近似值。其实 阅读全文
posted @ 2020-02-27 02:01 hulian425 阅读(3599) 评论(0) 推荐(0) 编辑
摘要: int main() { vector<int> a; a.push_back(1); a.push_back(2); for (auto &i : a) // 加上引用是安全的写法 { i = 3; cout << i << endl; } for (auto i:a) { cout << i < 阅读全文
posted @ 2020-02-24 01:41 hulian425 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 一般是sort(函数非法) std:sort 使用的是严格弱排序 严格是说在判断的时候会用"<",而不是"<=",弱排序是因为,一旦"<"成立便认为存在"<"关系,返回ture,而忽略了"="关系和">"区别,把它们归结为false。 bool cmp(int x, int y) { LL a = 阅读全文
posted @ 2020-02-20 00:04 hulian425 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 题目链接 https://ac.nowcoder.com/acm/contest/4137/M 就是一道模拟题, 重要的是题意理解清楚 #include<iostream> #include<string> #include <cstdlib> #include <algorithm> #inclu 阅读全文
posted @ 2020-02-01 23:10 hulian425 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://ac.nowcoder.com/acm/contest/4137/N 其实看到数据量 2000应该要想到时间复杂度基本就On2 题解:不管怎么合并,答案都一样的, 所有数两两乘积的和 代码 #include<iostream> #include<string> #inclu 阅读全文
posted @ 2020-02-01 19:02 hulian425 阅读(262) 评论(0) 推荐(0) 编辑
摘要: B. Infinite Prefixes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given strin 阅读全文
posted @ 2020-01-30 22:29 hulian425 阅读(203) 评论(0) 推荐(0) 编辑
摘要: c++中的string如何删掉最后一个字符 // 1. s = s.substr(0,s.size() - 1); // 2. s = s.erase(s.end() -1); // 3. s.pop_back(); 将string 转化为c的字符串 s.c_str(); char c[20]; s 阅读全文
posted @ 2020-01-30 14:29 hulian425 阅读(106) 评论(0) 推荐(0) 编辑
摘要: A. Display The Number time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a large el 阅读全文
posted @ 2020-01-30 13:47 hulian425 阅读(247) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 下一页