- 博客(6)
- 收藏
- 关注
原创 map简单用法
在做很多题的时候发现map真的好用 但是我不会 我现在也只学了一点皮毛 怕以后会忘掉 现在赶紧记下来 需要标记的题用map可能会事半功倍,数字被标记可以用数组 但是字符就不行了 头文件#include 定义map//
2017-04-05 20:47:12
360
原创 c++ 队列,栈,优先队列的基本操作
优先队列(priority_queue)的基本操作: struct node{ bool operator ()(int a,int b) { return a>b;//最小值优先 } }; struct node{ bool operator ()(int a,int b) { return
2017-02-21 19:34:45
287
转载 Tiling ,Tri Tiling(递推)
Tiling https://vjudge.net/problem/FZU-1147 经过自己手推可以的出来f[i]=f[i-1]+2*f[i-2];而且是大数,开两个数组控制格式 #include #include const int maxn=300; int a[maxn],b[maxn],c[maxn]; int main() { int n,k;
2016-12-22 16:51:43
373
原创 Teacher Bo (曼哈顿距离)
这种题要知道曼哈顿距离,百度得知d(i,j)=|X1-X2|+|Y1-Y2|. 这道题我看大牛博客说暴力能过 我至今对时间复杂度不是太了解 看来得补补了 #include #include #include using namespace std; const int maxn=100001; struct node { int x,y; }aa[maxn];
2016-12-22 16:47:36
332
转载 Root of the Problem(求a,a^n接近b)
看到这道题我的思路就是开for循环一直直到找到i^n接近于b,但是超时,看了别人的博客发现逆向思维真的简单。 先对b开n次方,上下取整去找a,而且我学到了两个函数, floor 向下取整 ceil 向上取整 代码: #include #include int main() { int b,n; double z; int p,q;
2016-12-21 20:59:39
409
转载 n!的长度
#include #include using namespace std; int main() { long n,k; double i,x; while(~scanf("%d",&n)) { x=0; for(i=1; i x+=log(i)/log(10.0);
2016-12-20 16:30:01
269
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅