- 博客(8)
- 收藏
- 关注
转载 1105 Spiral Matrix (25 分)
不加判断是否是最后一个N,最后一个测试点总过不了。https://www.cnblogs.com/wanghao-boke/p/9574335.html#include<cstdio>#include<cmath>#include<algorithm>using namespace std;const int maxn = 10010; //数字不能...
2018-11-30 11:10:03 342
转载 C/C++ 字符串与数字相互转换
https://www.cnblogs.com/happygirl-zjj/p/4633789.html一.利用stringstream类字符串到整数stringstream sstr(str);int x;sstr >> x;(即从sstr中提取数据)整数到字符串stringstream sstr;int x;sstr << x;string str...
2018-11-24 20:44:47 196
原创 1064 Complete Binary Search Tree (30 分)
一棵排序二叉树的中序遍历就是这一组数的递增序列。这边是完全二叉树,假设从0开始,那么节点i的左孩子的标号就是2i+1,右孩子的标号就是2(i+1)。先将这组数按照递增来排序,然后用中序遍历复原这棵完全排序二叉树,最后直接输出。#include <bits/stdc++.h>using namespace std;int a[1005],b[1005];int n,num=0;...
2018-11-24 15:28:08 104
原创 1067 Sort with Swap(0, i) (25 分)
看了大神的们的两种思路①如果0在本位上就先寻找一个当前不在本位上的数字与0交换,只要0不在本位,就将0所在位置的数的当前位置和0的位置交换。https://blog.csdn.net/hy971216/article/details/81272254#include<iostream>#include<cstdio>#include<algorithm>...
2018-11-24 11:31:39 154
原创 1057 Stack (30 分)
题目 Advanced Pat思路 树状数组 比较难看了很久才看懂,建议不会树状数组的可以去看一下这个大神的博客https://blog.csdn.net/flushhip/article/details/79165701讲的很清楚,很明白然后 参考这个大神的解释https://blog.csdn.net/SeasonJoe/article/details/80398898?utm_s...
2018-11-22 17:10:23 244
原创 1055 The World's Richest(25 分)
1055 The World’s Richest(25 分)Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, bu...
2018-11-18 20:02:47 103
转载 1051 Pop Sequence (25 分)
1051 Pop Sequence(25 分) Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to...
2018-11-17 20:44:30 81
转载 1045 Favorite Color Stripe (30 分)
1045 Favorite Color Stripe(30 分Eva’s favorite colors are limited. However the original stripe could be very long, and Eva would like to have the remaining favorite stripe with the maximum length. So ...
2018-11-17 15:54:13 159
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人