V2EX zjuturtle
 zjuturtle 最近的时间轴更新
zjuturtle

zjuturtle

V2EX 第 245065 号会员,加入于 2017-07-28 09:39:23 +08:00
zjuturtle 最近回复了
2023-12-10 23:29:29 +08:00
回复了 shaoshuang 创建的主题 宽带症候群 杭州电信 2000M 宽带办理踩坑记录
我也是余杭,一波投诉 299/月给了 1000/100.没有上行叠加包。实测大约 1100 上行/140 下行
2018-09-24 16:06:47 +08:00
回复了 chenchangjv 创建的主题 MacBook Pro 求推荐一款 mbp 外接显示器,现在准备是 p2415q
去亚马逊海淘个 LG UltraFine 4K 翻新版本吧
2018-04-13 22:03:31 +08:00
回复了 letianqiu 创建的主题 程序员 一道 FFT 相关的题
可以参考一下我的博客
https://zjuturtle.com/2017/12/26/fft/
2018-02-22 18:55:52 +08:00
回复了 harry890829 创建的主题 Apple 20 号在苹果官网定制了 macbook pro
其实你在苹果官网上买贵了 15%是有的,去麦克先生不好么
2018-02-20 23:05:09 +08:00
回复了 Weny 创建的主题 Apple 人生苦短, 不要 2k 屏幕,直接上 LG 5k 或者 iMac 27 5k
我有点后悔没买俩 5K
2018-02-19 17:17:07 +08:00
回复了 greenhat233 创建的主题 问与答 一道简单的 c++编程题求解答
@zjuturtle 日原题有很多变种我特么又贴错了,给跪。
原题
https://leetcode.com/problems/single-number/description/
解答
#include<iostream>
#include<vector>

using namespace std;
class Solution {
public:
int singleNumber(vector<int>& nums) {
int res = 0;
for (auto it = nums.begin(); it != nums.end(); it++) {
res ^= *it;
}
return res;
}
};
2018-02-19 17:13:27 +08:00
回复了 greenhat233 创建的主题 问与答 一道简单的 c++编程题求解答
@zjuturtle 日贴错了,应该是这个

#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int singleNumber(vector<int>& nums) {
vector<int> positiveCounts(32, 0);
vector<int> negtiveCounts(32, 0);
for (auto it = nums.begin(); it != nums.end(); it++) {
auto tmp = *it;
int index = 0;
if (tmp > 0) {
while (tmp!=0) {
positiveCounts[index] += (tmp % 2);
tmp /= 2;
index++;
}
}
else {
tmp = -tmp;
while (tmp != 0) {
negtiveCounts[index] += (tmp % 2);
tmp /= 2;
index++;
}
}
}
int pos = 0,neg=0,p=1,n=1;
for (int i = 0; i < 32; i++) {
auto pbit = positiveCounts[i] %= 3;
auto nbit = negtiveCounts[i] %= 3;
pos += (pbit*p);
neg += (nbit*n);
p *= 2;
n *= 2;
}
if(pos>0)
return pos;
return -neg;
}
};
2018-02-19 17:12:26 +08:00
回复了 greenhat233 创建的主题 问与答 一道简单的 c++编程题求解答
leetcode 上有这道题目
https://leetcode.com/problems/single-number-ii/description/
时间复杂度 O(n)
空间复杂度 O(1)

using namespace std;
class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
int tmp=0,tmp1=1,numA=0,numB=0;
for (auto it = nums.begin(); it != nums.end(); it++) {
tmp ^= (*it);
}
while (tmp % 2 == 0) {
tmp1 *= 2;
tmp /= 2;
}

for (auto it = nums.begin(); it != nums.end(); it++) {
if ((tmp1 ^ (*it)) == ((*it)-tmp1)) {
numA ^= (*it);
}
else {
numB ^= (*it);
}
}
auto res = new vector<int>;
(*res).push_back(numA);
(*res).push_back(numB);
return *res;
}
};
2018-02-19 16:59:38 +08:00
回复了 AxtonYao 创建的主题 分享创造 新年换新个人页
现在的年轻人都这么了啊。。。
2018-02-18 12:46:35 +08:00
回复了 cgcs 创建的主题 问与答 有人买过 Coursera 的企业版吗?
Business 完全没意义啊。我现在个人自己学,基本上只要申请奖学金都能给通过。惟二比较麻烦的是审核需要 15 天,专项课程的每一个小课程都要单独申请
关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2924 人在线   最高记录 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 13ms UTC 13:46 PVG 21:46 LAX 05:46 JFK 08:46
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86