|
SB (mfy01)
|
29ms |
432 KiB |
|
338 Bytes |
2023-2-3 17:49:54 |
|
新壹街.曾祥睿 (zxr)
|
29ms |
6.8 MiB |
|
294 Bytes |
2023-10-21 13:08:05 |
|
李哲 (lizhe)
|
29ms |
440 KiB |
|
240 Bytes |
2022-8-9 14:50:19 |
|
胡宸华 (huchenhua)
|
29ms |
7.7 MiB |
|
237 Bytes |
2023-7-12 10:56:06 |
|
孙烽轶 (sfy)
|
29ms |
7 MiB |
|
188 Bytes |
2023-7-9 9:50:26 |
|
魑归sama
|
30ms |
512 KiB |
|
255 Bytes |
2022-7-12 16:45:17 |
|
wangzihang
|
30ms |
436 KiB |
|
332 Bytes |
2023-4-1 18:05:28 |
|
张子轩 (zhangzixuana)
|
30ms |
456 KiB |
|
208 Bytes |
2023-5-3 12:37:25 |
|
金沙—彭智宸 (彭智宸)
|
30ms |
6.7 MiB |
|
186 Bytes |
2023-8-27 11:40:34 |
|
Randy Marsh (杨子腾)
|
30ms |
436 KiB |
|
239 Bytes |
2022-7-18 19:26:57 |
|
zlx (xiao)
|
30ms |
512 KiB |
|
259 Bytes |
2022-11-26 18:37:56 |
|
Jack
|
30ms |
436 KiB |
|
219 Bytes |
2023-3-22 19:37:59 |
|
22029-zjs
|
30ms |
384 KiB |
|
380 Bytes |
2022-12-17 11:57:27 |
|
RanHao
|
30ms |
6.9 MiB |
|
307 Bytes |
2023-7-26 11:27:01 |
|
陈忝锐
|
30ms |
512 KiB |
|
255 Bytes |
2022-2-12 17:54:51 |
|
22029-lyh
|
30ms |
384 KiB |
|
207 Bytes |
2022-12-17 11:44:58 |
|
手搓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)
|
31ms |
384 KiB |
|
330 Bytes |
2022-12-13 18:35:54 |
|
曾龙兮
|
31ms |
512 KiB |
|
218 Bytes |
2023-5-28 13:07:23 |
|
疯神芭芭脱丝 (李卓修)
|
31ms |
512 KiB |
|
302 Bytes |
2023-4-16 19:24:07 |
|
黄梓轩 (huangzixuan)
|
31ms |
396 KiB |
|
209 Bytes |
2023-5-28 14:44:00 |
|
周琪渃
|
31ms |
412 KiB |
|
280 Bytes |
2022-12-7 20:36:18 |
|
22029-lsl
|
31ms |
392 KiB |
|
196 Bytes |
2022-12-17 11:59:29 |
|
新壹街——陈学彬 (BUG)
|
31ms |
7 MiB |
|
198 Bytes |
2023-7-6 10:48:25 |
|
胡程禹
|
31ms |
6.7 MiB |
|
246 Bytes |
2023-9-13 20:45:27 |
|
许律天
|
31ms |
7.2 MiB |
|
235 Bytes |
2023-12-14 20:07:33 |
|
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)
|
31ms |
7.1 MiB |
|
302 Bytes |
2023-7-14 11:42:46 |
|
坤坤荔枝小黑子 (zhonghaotian22006)
|
31ms |
512 KiB |
|
229 Bytes |
2022-11-3 18:35:30 |
|
时代一校 - 冯隆浩 (冯隆浩)
|
31ms |
6.7 MiB |
|
210 Bytes |
2023-7-18 11:37:30 |
|
无尽的想象 (谭仕高)
|
31ms |
6.7 MiB |
|
293 Bytes |
2023-6-8 15:34:33 |
|
我推的乱破 (贺俊楠)
|
31ms |
7 MiB |
|
311 Bytes |
2023-7-10 14:41:35 |
|
偽艺術家 (chenyanchi22006)
|
32ms |
520 KiB |
|
174 Bytes |
2022-8-24 10:28:45 |
|
源著校区-刘洋-付柏乐 (付柏乐)
|
32ms |
7.4 MiB |
|
322 Bytes |
2023-7-20 15:11:31 |
|
廖海宇在追杀马牌痞 (liaohaiyu22031)
|
32ms |
436 KiB |
|
265 Bytes |
2022-12-17 11:53:35 |
|
小忙果 (王昱杰)
|
32ms |
7.3 MiB |
|
204 Bytes |
2023-7-18 9:25:59 |
|
我是个s* (lijinze)
|
32ms |
6.8 MiB |
|
231 Bytes |
2023-6-28 14:37:58 |
|
11451254188 (22029-mjh)
|
32ms |
436 KiB |
|
344 Bytes |
2022-12-14 18:00:41 |
|
邵冠铖 (shaoguancheng22031)
|
32ms |
512 KiB |
|
162 Bytes |
2023-1-11 17:24:40 |
|
时代校区-刘臣原 (微笑王子)
|
33ms |
512 KiB |
|
228 Bytes |
2022-9-10 14:11:24 |
|
罗翌珂 (dangdang)
|
33ms |
512 KiB |
|
271 Bytes |
2022-9-5 22:32:20 |
|
ttt123
|
33ms |
512 KiB |
|
318 Bytes |
2022-12-16 16:47:01 |
|
李山水
|
33ms |
440 KiB |
|
256 Bytes |
2022-3-12 18:28:06 |
|
^_^ (ctc)
|
34ms |
512 KiB |
|
226 Bytes |
2022-12-19 16:36:47 |
|
欧俊阳
|
36ms |
6.9 MiB |
|
284 Bytes |
2023-8-9 13:42:56 |
|
wangjun
|
38ms |
7.2 MiB |
|
275 Bytes |
2023-11-30 12:25:56 |
|
林凡童 (lft)
|
39ms |
512 KiB |
|
318 Bytes |
2022-9-15 20:04:05 |
|
谭懿轩 (yanyixuan)
|
41ms |
436 KiB |
|
179 Bytes |
2022-8-23 18:10:09 |
|
zyl
|
42ms |
7 MiB |
|
306 Bytes |
2024-1-6 14:15:39 |
|
张雯皓 (zhangwenhao)
|
49ms |
7 MiB |
|
266 Bytes |
2023-12-23 11:29:37 |
|
赵奕铭
|
118ms |
764 KiB |
|
167 Bytes |
2024-3-8 21:44:26 |
|
曹雅萱
|
122ms |
764 KiB |
C++11 |
256 Bytes |
2024-11-23 11:20:30 |
|
李浩然
|
123ms |
780 KiB |
C++98 |
177 Bytes |
2024-11-17 16:10:54 |
|
千千万万
|
125ms |
764 KiB |
|
239 Bytes |
2024-3-17 19:21:27 |
|
陌生人 (涂玉龙)
|
129ms |
764 KiB |
|
211 Bytes |
2024-3-17 15:31:41 |
|
yuchenyi23017
|
130ms |
768 KiB |
|
210 Bytes |
2024-1-28 15:29:57 |
|
贾博涵
|
131ms |
768 KiB |
|
303 Bytes |
2024-3-6 14:01:39 |
|
邱越
|
132ms |
544 KiB |
|
218 Bytes |
2024-1-26 20:50:24 |
|
jdy
|
133ms |
536 KiB |
|
356 Bytes |
2024-3-10 14:21:18 |
|
阮 (媚狐不吃道旁李)
|
133ms |
768 KiB |
|
356 Bytes |
2024-4-13 10:25:55 |
|
叶哲宇 (yzy)
|
133ms |
764 KiB |
|
209 Bytes |
2024-2-24 9:20:39 |
|
My name is Man (钟卓劭)
|
134ms |
536 KiB |
|
249 Bytes |
2024-3-19 15:17:38 |
|
周靖淞 (zhoujingsong)
|
136ms |
548 KiB |
|
286 Bytes |
2024-3-17 18:52:41 |
|
Him神
|
136ms |
764 KiB |
|
183 Bytes |
2024-2-23 16:17:22 |
|
( ) (李恺伦)
|
137ms |
764 KiB |
C++11 |
124 Bytes |
2024-9-25 20:57:52 |
|
安闵煜 (anzai)
|
138ms |
764 KiB |
C++11 |
255 Bytes |
2024-8-31 14:26:34 |
|
这是非常▦▦▦的 (段秉辰)
|
140ms |
764 KiB |
C++17 |
213 Bytes |
2024-9-30 17:34:52 |
|
周浩楠 (开朗的周好难)
|
141ms |
792 KiB |
C++11 |
256 Bytes |
2024-11-25 17:06:12 |
|
猫不理包子
|
383ms |
8.9 MiB |
Python 3 |
82 Bytes |
2023-9-21 14:24:42 |
|
kongql
|
386ms |
8.9 MiB |
Python 3 |
171 Bytes |
2023-8-4 21:23:30 |
|
谭红中 (不知道)
|
415ms |
3.9 MiB |
Python 3 |
115 Bytes |
2022-4-4 14:08:19 |
|
王文林
|
416ms |
4.1 MiB |
Python 3 |
61 Bytes |
2022-2-11 13:32:16 |
|
cola
|
419ms |
4 MiB |
Python 3 |
234 Bytes |
2022-1-30 11:49:11 |
|
梨冻亿 (wiueh)
|
420ms |
3.9 MiB |
Python 3 |
61 Bytes |
2022-1-23 18:37:18 |
|
爱琴海校区-刁钲洋 (刁钲洋)
|
433ms |
3.9 MiB |
Python 3 |
85 Bytes |
2022-4-12 21:59:52 |