|
yanglang
|
14ms |
384 KiB |
|
230 Bytes |
2022-10-22 20:45:33 |
|
蒲梓勋 (puzixun)
|
14ms |
384 KiB |
|
230 Bytes |
2022-11-29 22:26:41 |
|
姚宏逸
|
14ms |
384 KiB |
|
287 Bytes |
2022-1-25 22:36:53 |
|
曾御城(现用名) (Jason)
|
14ms |
440 KiB |
|
250 Bytes |
2022-6-30 17:33:10 |
|
10255
|
14ms |
384 KiB |
|
213 Bytes |
2023-5-10 18:47:09 |
|
三差学生 (尘埃蓝莓)
|
14ms |
6.9 MiB |
|
188 Bytes |
2023-10-28 19:15:55 |
|
王乐仪
|
14ms |
512 KiB |
|
260 Bytes |
2022-2-4 13:45:16 |
|
郭人瑀作业号
|
14ms |
436 KiB |
|
236 Bytes |
2022-8-2 14:52:31 |
|
任童(rentong)
|
14ms |
516 KiB |
|
268 Bytes |
2022-7-2 14:43:53 |
|
龙湖时代C馆-邹镇宇 (邹镇宇)
|
14ms |
512 KiB |
|
351 Bytes |
2023-5-12 22:22:43 |
|
CK (李弘毅)
|
14ms |
6.7 MiB |
|
260 Bytes |
2023-9-17 9:40:15 |
|
况奕辛 (KYX_yyds)
|
14ms |
440 KiB |
|
236 Bytes |
2022-2-25 20:22:16 |
|
谭懿轩 (yanyixuan)
|
14ms |
428 KiB |
|
194 Bytes |
2022-2-15 14:58:24 |
|
靳博然 (jbr)
|
14ms |
384 KiB |
|
239 Bytes |
2023-3-26 17:34:28 |
|
zzl
|
14ms |
384 KiB |
|
187 Bytes |
2023-5-25 11:57:51 |
|
scallway
|
14ms |
432 KiB |
|
226 Bytes |
2022-9-15 16:40:18 |
|
马渝杭 (mayuhang)
|
14ms |
444 KiB |
|
240 Bytes |
2022-8-22 12:02:57 |
|
朱老师 (zyp)
|
14ms |
384 KiB |
|
196 Bytes |
2023-4-19 20:11:52 |
|
手搓STL stack 双向无环链表 _ 向量 2种实现方式: template <typename Map_Type> class Stack_l /* Stack _ List */ { private: struct Node { Map_Type Node_Data; Node *nextp, *lastp; Node(void) { nextp = 0; lastp = 0; } }; struct List_Data { unsigned int List_Size; Node *headp, *endp; List_Data(void) { List_Size = 0; headp = 0; endp = 0; } }Data; struct Vector_Data { Map_Type *headp, *lastp, *endp; void resize(unsigned int data_size) { Map_Type *newp = new Map_Type[data_size](); endp = newp + data_size - 1; lastp = newp + (data_size > lastp - headp ? lastp - headp : data_size); if (headp) delete[] headp; headp = newp; } Vector_Data(void) { headp = 0; lastp = 0; endp = 0; } }; public: unsigned int size(void) { return Data.List_Size; } Map_Type& top(void) { return Data.endp -> Node_Data; } void* data(void) { return &Data; } bool empty(void) { return !((bool)Data.headp); } Stack_l<Map_Type>& push(Map_Type push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(Map_Type& push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(Map_Type* push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = *push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(const Map_Type* push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = *(Map_Type*)push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& pop(void) { if (Data.headp) { if (Data.List_Size == 1u) { delete Data.headp; Data.List_Size = 0; Data.headp = 0; Data.endp = 0; } else { Data.endp = Data.endp -> lastp; delete Data.endp -> nextp; Data.endp -> nextp = 0; --Data.List_Size; } } return *this; } Stack_l<Map_Type>& clear(void) { while (Data.List_Size) { pop(); } return *this; } Stack_l<Map_Type>(void) { /* NULL */ } Stack_l<Map_Type>(unsigned int data_size, Map_Type map_data) { Data.List_Size = data_size; while (data_size--) { Node *nodep = new Node(); nodep -> Node_Data = map_data; if (Data.headp) { nodep -> lastp = Data.endp; Data.endp -> nextp = nodep; Data.endp = nodep; } else { Data.headp = nodep; Data.endp = nodep; } } } Stack_l<Map_Type>(Stack_l<Map_Type>& map_data) { if (!map_data.empty()) { List_Data *listp = (List_Data*)map_data.data(); Node *nodep = listp -> headp, *newp; for (unsigned int i = 0; i != listp -> List_Size; ++i, nodep = nodep -> nextp) { newp = new Node(); newp -> Node_Data = nodep -> Node_Data; if (Data.headp) { newp -> lastp = Data.endp; Data.endp -> nextp = newp; Data.endp = newp; } else { Data.headp = newp; Data.endp = newp; } } Data.List_Size = listp -> List_Size; } } Stack_l<Map_Type>& operator=(Stack_l<Map_Type>& copy_data) { if (copy_data.empty()) return *this; List_Data *listp = (List_Data*)copy_data.data(); Node *nodep = listp -> headp, *newp; for (unsigned int i = 0; i != listp -> List_Size; ++i, nodep = nodep -> nextp) { newp = new Node(); newp -> Node_Data = nodep -> Node_Data; if (Data.headp) { newp -> lastp = Data.endp; Data.endp -> nextp = newp; Data.endp = newp; } else { Data.headp = newp; Data.endp = newp; } } Data.List_Size = listp -> List_Size; return *this; } bool operator==(Stack_l<Map_Type>& cmp_data) { if (cmp_data.size() != Data.List_Size) return false; else if (cmp_data.empty() && (!Data.List_Size)) return true; Node *nodep1 = Data.headp, *nodep2 = ((List_Data*)cmp_data.data()) ->headp; for (unsigned int i = 0; i != Data.List_Size; ++i, nodep1 = nodep1 -> nextp, nodep2 = nodep2 ->nextp) { if (nodep1 -> Node_Data != nodep2 -> Node_Data) return false; } return true; } bool operator!=(Stack_l<Map_Type>& cmp_data) { if (cmp_data.size() == Data.List_Size) return false; else if (cmp_data.empty() && (!Data.List_Size)) return false; Node *nodep1 = Data.headp, *nodep2 = ((List_Data*)cmp_data.data()) ->headp; for (unsigned int i = 0; i != Data.List_Size; ++i, nodep1 = nodep1 -> nextp, nodep2 = nodep2 ->nextp) { if (nodep1 -> Node_Data != nodep2 -> Node_Data) return true; } return true; } ~Stack_l<Map_Type>(void) { clear(); } }; /* Stack _ List */ template <typename Map_Type> class Stack_v /* Stack _ Vector */ { private: struct Node { Map_Type Node_Data; Node *nextp, *lastp; Node(void) { nextp = 0; lastp = 0; } }; struct List_Data { unsigned int List_Size; Node *headp, *endp; List_Data(void) { List_Size = 0; headp = 0; endp = 0; } }; struct Vector_Data { Map_Type *headp, *lastp, *endp; void resize(unsigned int data_size) { Map_Type *newp = new Map_Type[data_size](); endp = newp + data_size - 1; lastp = newp + (data_size > lastp - headp ? lastp - headp : data_size); if (headp) delete[] headp; headp = newp; } Vector_Data(void) { headp = 0; lastp = 0; endp = 0; } }Data; public: unsigned int size(void) { return Data.lastp - Data.headp; } Map_Type& top(void) { return *(Data.lastp - 1); } void* data(void) { return &Data; } bool full(void) { if (!Data.headp) return true; return Data.endp + 1 == Data.lastp; } bool empty(void) { if (!Data.headp) return true; return Data.headp == Data.lastp; } Stack_v<Map_Type>& push(Map_Type push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(Map_Type& push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(Map_Type* push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = *push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(const Map_Type* push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = *(Map_Type*)push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& pop(void) { if (empty()) { if (Data.lastp - Data.headp > 1) Data.resize((Data.lastp - Data.headp) >> 1); else return *this; } else --Data.lastp; return *this; } Stack_v<Map_Type>(void) { /* NULL */ } Stack_v<Map_Type>(unsigned int data_size, Map_Type map_data) { while (data_size) { push(&map_data); --data_size; } } Stack_v<Map_Type>(Stack_v<Map_Type>& map_data) { Vector_Data *datap = (Vector_Data*)map_data.data(); for (unsigned int i = 0, k = map_data.size(); i != k; ++i) push(datap -> headp + i); } Stack_v<Map_Type>& operator=(Stack_v<Map_Type>& copy_data) { if (copy_data.empty()) clear(); else { Vector_Data *datap = (Vector_Data*)copy_data.data(); for (unsigned int i = 0, k = copy_data.size(); i != k; ++i) push(datap -> headp + i); } return *this; } bool operator==(Stack_v<Map_Type>& cmp_data) { if (size() != cmp_data.size()) return false; else if (empty() && cmp_data.empty()) return true; Vector_Data *datap = (Vector_Data*)cmp_data.data(); for (unsigned int i = 0, k = size(); i != k; ++i) { if (*(Data.headp + i) != *(datap ->headp + i)) return false; } return true; } bool operator!=(Stack_v<Map_Type>& cmp_data) { if (size() != cmp_data.size()) return true; else if (empty() && cmp_data.empty()) return false; Vector_Data *datap = (Vector_Data*)cmp_data.data(); for (unsigned int i = 0, k = size(); i != k; ++i) { if (*(Data.headp + i) != *(datap -> headp + i)) return true; } return false; } Stack_v<Map_Type>& clear(void) { delete[] Data.headp; Data.headp = 0; Data.lastp = 0; Data.endp = 0; return *this; } ~Stack_v<Map_Type>(void) { delete[] Data.headp; } }; /* Stack _ Vector */ int main(void) { return 0; } (22029-xys)
|
14ms |
432 KiB |
|
292 Bytes |
2022-11-13 18:39:52 |
|
炸鱼4000+ (dxc)
|
14ms |
6.9 MiB |
C++14(O2) |
230 Bytes |
2024-8-22 8:57:56 |
|
贾鑫豪 (Mr Sam)
|
14ms |
512 KiB |
|
507 Bytes |
2022-3-3 6:42:04 |
|
潘光瑞 (NB牛牛大师)
|
14ms |
512 KiB |
|
270 Bytes |
2022-8-11 11:45:49 |
|
呵呵呵 (陈思琦)
|
14ms |
392 KiB |
|
207 Bytes |
2022-9-17 17:35:56 |
|
明哲瀚 (18580067605)
|
14ms |
392 KiB |
|
259 Bytes |
2022-11-5 17:01:42 |
|
爱琴海校区-刁钲洋 (刁钲洋)
|
14ms |
440 KiB |
|
279 Bytes |
2023-2-8 19:02:56 |
|
牟淳雅
|
14ms |
6.9 MiB |
|
255 Bytes |
2023-7-27 18:16:14 |
|
草||草 (陈星佑)
|
14ms |
420 KiB |
|
272 Bytes |
2022-6-11 9:48:06 |
|
曹埊睿 (caodirui)
|
14ms |
444 KiB |
|
290 Bytes |
2023-4-18 18:46:59 |
|
wangyueru
|
14ms |
436 KiB |
|
229 Bytes |
2022-10-29 19:34:29 |
|
余彦瑞
|
14ms |
444 KiB |
|
258 Bytes |
2022-6-12 8:52:29 |
|
明哲瀚 (18580067605)
|
14ms |
392 KiB |
|
250 Bytes |
2022-11-3 20:55:46 |
|
明哲瀚 (18580067605)
|
14ms |
384 KiB |
|
259 Bytes |
2022-11-2 20:05:11 |
|
dinghaoyan1
|
14ms |
384 KiB |
|
259 Bytes |
2022-11-5 16:23:49 |
|
WangXi
|
15ms |
384 KiB |
|
233 Bytes |
2022-10-29 19:37:39 |
|
22029-zjs
|
15ms |
512 KiB |
|
271 Bytes |
2022-11-19 11:49:18 |
|
明哲瀚 (18580067605)
|
15ms |
384 KiB |
|
259 Bytes |
2022-11-4 21:14:30 |
|
德克萨斯做的到吗 (liyangbao)
|
15ms |
384 KiB |
|
259 Bytes |
2022-11-12 10:24:42 |
|
李彦臻
|
15ms |
436 KiB |
|
295 Bytes |
2022-11-16 9:56:49 |
|
***
|
15ms |
512 KiB |
|
324 Bytes |
2023-3-2 15:26:42 |
|
zhangxinyue
|
15ms |
512 KiB |
|
279 Bytes |
2022-11-15 21:31:14 |
|
明哲瀚 (18580067605)
|
15ms |
384 KiB |
|
249 Bytes |
2022-10-29 20:09:28 |
|
周琪渃
|
15ms |
384 KiB |
|
325 Bytes |
2022-12-24 18:02:52 |
|
zzy
|
15ms |
444 KiB |
|
294 Bytes |
2023-4-8 16:12:42 |
|
yuzk
|
15ms |
6.9 MiB |
C++11 |
231 Bytes |
2024-8-23 16:11:57 |
|
黄鹏翰
|
15ms |
388 KiB |
|
221 Bytes |
2022-11-5 16:08:09 |
|
zjz
|
15ms |
384 KiB |
|
226 Bytes |
2022-1-25 10:47:29 |
|
Yangshenxin (𝒲𝒶𝓉𝑒𝓇)
|
15ms |
392 KiB |
|
342 Bytes |
2022-1-23 18:29:37 |
|
綰綰(HHYT)
|
15ms |
7.1 MiB |
C++11 |
236 Bytes |
2024-4-18 19:30:23 |
|
yuhaodi
|
15ms |
428 KiB |
|
656 Bytes |
2023-4-24 18:44:06 |
|
明哲瀚 (18580067605)
|
15ms |
384 KiB |
|
268 Bytes |
2022-11-4 21:18:03 |
|
张梓浩 (zhangzihao)
|
15ms |
440 KiB |
|
257 Bytes |
2023-3-29 21:03:39 |
|
明哲瀚 (18580067605)
|
15ms |
392 KiB |
|
250 Bytes |
2022-11-2 19:00:12 |
|
张祖名
|
15ms |
6.7 MiB |
|
257 Bytes |
2023-8-30 14:11:12 |
|
huanglu
|
15ms |
7.1 MiB |
|
216 Bytes |
2023-7-15 16:22:33 |
|
xflt_dyp
|
15ms |
6.9 MiB |
|
310 Bytes |
2023-7-22 16:43:38 |
|
无尽的想象 (谭仕高)
|
15ms |
432 KiB |
|
195 Bytes |
2022-7-27 10:55:20 |
|
呵呵呵 (陈思琦)
|
15ms |
436 KiB |
|
207 Bytes |
2022-9-17 17:35:14 |
|
xiongxinyao
|
15ms |
384 KiB |
|
226 Bytes |
2022-10-14 20:02:02 |
|
吃小孩的viv_
|
15ms |
7.4 MiB |
|
239 Bytes |
2023-7-18 17:45:23 |
|
欧俊阳
|
15ms |
6.9 MiB |
|
191 Bytes |
2023-7-26 21:10:33 |
|
源著校区-宋昊成 (马冬梅)
|
15ms |
440 KiB |
|
317 Bytes |
2023-2-25 18:14:53 |
|
陈杰晟
|
15ms |
384 KiB |
|
283 Bytes |
2022-2-19 11:06:02 |
|
jighghjkfkhfdhdfdfdsfsdfsafvmnkbnkbmnlvnmkbvnvb;,.m;,;.;,;kbvlmkbnlmkblnvkmlbnkmlbvkmlbvklmbkmlkblmbnm;,l.,.;,'.,';.[',;.[,kjkoihgfhfgiohifgohifgohiofgihgofhiofgihofgihofgihofgiho;''[;.',m;.',m.;',.;'m,.;';'cv;x'cb'cx;b'cv;b'xc;b'c;b'cvbvc.'bv.//,/vb./vcb./cvbv,c.b,cv.,b.cv,b.vc,bg;hgl;hgl;hg;h;hfg;hl;lf;l;lxc;cln;bvln;vcln;vnl;vbl;vbln;vlv;blnvb;plnp;lplhfljpjh;nlvb;nv;bn;vcvl;nlv;nlv;g;hjhchl;ghfghl;fghl;ltlh;l;hlf;lg;bnlc;;nlv;nbv;nbv;nvb;nlvcnl;xc;blxcb;ll;hg;lhgl;dfl;t;ldy;l;lyl;rewlt493;l;dl;dsflg;lsdlpbpcxobpocvbpopopopreopotpreotertertretert (litingxu)
|
15ms |
6.9 MiB |
C++98 |
330 Bytes |
2024-5-26 15:30:29 |
|
霍弈丞小号
|
15ms |
428 KiB |
|
255 Bytes |
2023-4-9 12:23:12 |
|
scallway
|
15ms |
6.8 MiB |
|
226 Bytes |
2023-6-23 14:28:23 |
|
Nico
|
15ms |
436 KiB |
|
265 Bytes |
2023-4-16 14:41:57 |
|
星野 光 (Hoshino Hikari)
|
15ms |
6.8 MiB |
|
349 Bytes |
2023-10-23 19:49:28 |
|
22029-lsl
|
15ms |
512 KiB |
|
307 Bytes |
2022-11-19 10:43:52 |
|
洛阳 锦程 (郭思利)
|
15ms |
7.2 MiB |
C++98 |
219 Bytes |
2024-5-19 9:52:36 |
|
shenyushun2
|
15ms |
432 KiB |
|
262 Bytes |
2022-12-6 19:32:43 |
|
贾博涵
|
15ms |
6.8 MiB |
|
223 Bytes |
2023-11-8 11:58:41 |
|
张月恒
|
15ms |
7 MiB |
C++98(O2) |
206 Bytes |
2024-6-26 14:02:36 |
|
22029-lyh
|
15ms |
432 KiB |
|
307 Bytes |
2022-11-19 10:09:29 |
|
Nico
|
15ms |
6.9 MiB |
|
233 Bytes |
2023-7-27 18:02:40 |
|
坤坤荔枝小黑子 (zhonghaotian22006)
|
15ms |
436 KiB |
|
261 Bytes |
2022-11-14 8:49:03 |
|
明哲瀚 (18580067605)
|
15ms |
432 KiB |
|
250 Bytes |
2022-11-2 18:58:55 |
|
龚铭俊 (哈哈哈)
|
15ms |
6.9 MiB |
|
223 Bytes |
2023-7-23 13:53:52 |
|
wuqi
|
15ms |
6.9 MiB |
|
254 Bytes |
2023-7-23 14:50:40 |
|
德克萨斯做的到吗 (liyangbao)
|
16ms |
512 KiB |
|
270 Bytes |
2022-11-12 10:24:36 |
|
Tender. (05c05-zhou)
|
16ms |
512 KiB |
|
252 Bytes |
2022-10-17 20:39:41 |
|
dengfeng
|
16ms |
512 KiB |
|
241 Bytes |
2022-12-29 10:59:23 |
|
新壹街陈科言 (cky)
|
16ms |
6.9 MiB |
|
310 Bytes |
2023-7-20 13:40:00 |
|
时代一校-王宥量 (wangyouliang)
|
16ms |
512 KiB |
|
244 Bytes |
2022-10-16 12:16:37 |
|
RanHao
|
16ms |
7 MiB |
|
239 Bytes |
2023-7-18 15:58:21 |
|
Jose (反恐皮蛋)
|
16ms |
424 KiB |
|
248 Bytes |
2022-10-14 20:01:41 |
|
wzzjnb2012
|
16ms |
452 KiB |
|
257 Bytes |
2022-9-30 8:39:00 |
|
Jack
|
16ms |
392 KiB |
|
276 Bytes |
2022-10-14 20:02:12 |
|
时代1校-杨宇轩 (杨宇轩)
|
16ms |
6.7 MiB |
|
248 Bytes |
2023-8-21 13:50:08 |
|
ganlin1
|
17ms |
6.7 MiB |
|
192 Bytes |
2023-6-7 14:27:00 |
|
杨坤霖 (steven)
|
17ms |
512 KiB |
|
230 Bytes |
2023-1-16 8:40:28 |
|
明哲瀚 (18580067605)
|
17ms |
512 KiB |
|
259 Bytes |
2022-11-4 21:10:53 |
|
谁陪訫牞 (杀手) (22029-zys)
|
17ms |
444 KiB |
|
279 Bytes |
2023-1-13 17:24:09 |
|
重庆龙湖源著校区+杨聆暄 (杨聆暄)
|
17ms |
440 KiB |
|
271 Bytes |
2023-1-14 15:22:26 |
|
时代一校-赵彦博 (zyb)
|
17ms |
6.9 MiB |
|
283 Bytes |
2023-8-3 14:54:08 |
|
周琪渃
|
17ms |
444 KiB |
|
325 Bytes |
2022-12-24 18:02:44 |
|
爱情海校区—沙天一 (沙天一)
|
17ms |
7.1 MiB |
|
219 Bytes |
2023-7-9 9:24:42 |
|
新壹街校区-吴鑫鹏 (吴鑫鹏)
|
17ms |
392 KiB |
|
286 Bytes |
2022-10-14 20:02:19 |
|
xflt_dyp
|
17ms |
6.9 MiB |
|
245 Bytes |
2023-8-11 14:10:19 |
|
繁星 (05c35-zzm)
|
17ms |
444 KiB |
|
200 Bytes |
2022-11-15 17:11:16 |
|
吃小孩的viv_
|
17ms |
436 KiB |
|
191 Bytes |
2023-3-15 15:37:21 |