LZW?????C/C++???
???????????? ???????[ 2016/2/3 10:46:27 ] ????????.NET ???????????
????LZW???????????????????????y??????????????????????????????? LZW???????Unisys?????????Ч???2003?????????????????????
????????????????LZW???????????????????????????????????????????(cai)??(bi)?????struct && ????????????????ɡ?
#include <stdio.h> #include <algorithm> #include <math.h> #include <iostream> #include <stdlib.h> #include <string.h> using namespace std; struct Node{ int pre;//????????????? char c;//?????? }KDA[65535]; int cnt??P??Q; char W??V; void Init(){//?256??????????ASCII?????? for(int i = 0;i < 256; i ++){ KDA[i].pre = -1; KDA[i].c = i; } cnt = 256; P = -1; } void Out(int x){ //????????????????????λ????????????? if(KDA[x].pre != -1){ Out(KDA[x].pre); } else { V = KDA[x].c; } printf("%c"??KDA[x].c); } void Search(){ int flag = 0; for(int i = 0;i < cnt;i ++){ if(KDA[i].pre == P && KDA[i].c == W){//?????????????????????? P = i; flag = 1; } } if(!flag){ //?????????????????????????????????????? KDA[cnt].pre = P; KDA[cnt].c = W; printf("%03X "??P); P = (int)W; cnt ++; } } void Research(){ Out(Q); if(P != -1){ //??????λ?????????????λ????????????????????λ???????μ?????????? KDA[cnt].pre = P; KDA[cnt].c = V; cnt ++; } } void Compress(){<span style="white-space:pre"></span>//??????? Init(); freopen("LZWin.txt"??"r"??stdin); freopen("LZWch.txt"??"w"??stdout); while((W = getchar()) && W != EOF){ Search(); } printf("%03X "??P); } void Decompress(){<span style="white-space:pre"></span>//??????? Init(); freopen("LZWch.txt"??"r"??stdin); freopen("LZWout.txt"??"w"??stdout); while(scanf("%03X"??&Q)!= EOF){ Research(); } } int main(){ Compress(); Decompress(); return 0; }
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????