摘要:
辗转相除法求最大公约数#include #include using namespace std;long long greatestCommon(long long a, long long b) { if (a == 0 || b == 0) { return 1; }... 阅读全文
posted @ 2014-12-01 15:09
傻喵
阅读(155)
评论(0)
推荐(0)
摘要:
注意到数据规模比较小(N#include #include using namespace std;int n;bool compare(vector a, vector b) { for (int i = 0; i != n; ++i) { if (a[i] != b[i]) ... 阅读全文
posted @ 2014-12-01 11:44
傻喵
阅读(169)
评论(0)
推荐(0)
摘要:
依题意构造树并遍历,找出最大深度并统计#include #include using namespace std;struct Node { vector children; int depth;};Node nodes[100005];int maxDepth = 0;int tota... 阅读全文
posted @ 2014-12-01 11:30
傻喵
阅读(130)
评论(0)
推荐(0)
摘要:
如果使用递归,会因为递归层数过多导致段错误因此使用queue代替递归#include #include #include using namespace std;struct Point { int z, x, y; Point(int z, int x, int y) : z(z), ... 阅读全文
posted @ 2014-12-01 11:21
傻喵
阅读(232)
评论(4)
推荐(0)
浙公网安备 33010602011771号