这个账单看不懂,求用秦九韶算法求多项式

求助,对LZW算法的C语言实现有一些看不懂,能不能帮忙看看_c语言吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:285,186贴子:
求助,对LZW算法的C语言实现有一些看不懂,能不能帮忙看看收藏
/* Basic LZW Data Compression program published in DDJ October 1989 issue. * Original Author: Mark R. Nelson * Updated by: Shawn M. Regan, January 1990 * Added: - Method to clear table when compression ratio degrades *
- Self adjusting code size capability (up to 14 bits) * Updated functions are marked with "MODIFIED". main() has been updated also * Compile with -ml (large model) for MAX_BITS == 14 only */ #include &stdio.h&#include &stdlib.h&#include &malloc.h&#include &string.h&#include &windows.h& #define INIT_BITS 9
#define MAX_BITS
/* Do not exceed 14 with this program */#define HASHING_SHIFT MAX_BITS - 8 #if MAX_BITS == 14
/* Set the table size. Must be a prime */#define TABLE_SIZE 18041
/* number somewhat larger than 2^MAX_BITS.*/#elif MAX_BITS == 13#define TABLE_SIZE 9029#else#define TABLE_SIZE 5021#endif #define CLEAR_TABLE 256
/* Code to flush the string table LZW算法常用八位字符*/#define TERMINATOR
/* To mark EOF Condition, instead of MAX_VALUE 在输入任何数据前优先占用字典的前256项(0~255)*/#define FIRST_CODE
/* First available code for code_value table */#define CHECK_TIME
/* Check compress ratio every CHECK_TIME chars input */ #define MAXVAL(n) (( 1 &&( n )) -1)
/* max_value formula macro */ unsigned input_code();
//声明函数 void *malloc(); int *code_
/* This is the code value array */unsigned int *prefix_
/* This array holds the prefix codes */unsigned char *append_
/* This array holds the appended chars */unsigned char decode_stack[4000];
/* This array holds the decoded string */ int num_bits=INIT_BITS;
/* Starting with 9 bit codes*/unsigned long bytes_in=0,bytes_out=0; /* Used to monitor compression ratio */int max_
/* old MAX_CODE */unsigned long checkpoint=CHECK_TIME;
/* For compression ratio monitoring CHECK_TIME=100*/ compress(FILE *input, FILE *output);find_match(int hash_prefix, unsigned int hash_character);char *decode_string(unsigned char *buffer, unsigned int code);output_code(FILE *output, unsigned int code);expand(FILE *input, FILE *output);unsigned input_code(FILE *input); main(int argc, char *argv[]){
FILE *input_file, *output_file, *lzw_//文件型指针
char input_file_name[81]; /* The three buffers for the compression phase.
code_value=(int*)malloc(TABLE_SIZE*sizeof(signed int));
prefix_code=(unsigned int*)malloc(TABLE_SIZE*sizeof(unsigned int));
append_character=(unsigned char*)malloc(TABLE_SIZE*sizeof(unsigned char));
if (code_value==NULL || prefix_code==NULL || append_character==NULL) {
printf("Error allocating table space!\n");
} /* Get the file name, open it, and open the LZW output file. */
if (argc&1)
strcpy(input_file_name,argv[1]);
printf("Input file name: ");
scanf("%s",input_file_name);
//打开input_file文件
input_file=fopen(input_file_name,"rb");//打开文件函数,要打开的文件名及文件的模式,返回值是指针
lzw_file=fopen("test.lzw","wb");
if (input_file == NULL || lzw_file == NULL) {
printf("Error opening files\n");
max_code = MAXVAL(num_bits);
/* Initialize max_value & max_code 进行初始化*/
compress(input_file,lzw_file);
/* Call compression routine 传递的是两个指针实参*/
fclose(input_file);
fclose(lzw_file);
free(code_value);
/* Needed only for compression */
lzw_file=fopen("test.lzw","rb");
output_file=fopen("test.out","wb");
if (lzw_file == NULL || output_file == NULL) {
printf("Error opening files\n");
num_bits=INIT_BITS;
/* Re-initialize for expansion INIT_BITS符号常量 */
max_code = MAXVAL(num_bits);
expand(lzw_file,output_file);
/* Call expansion routine */
fclose(lzw_file);
/* Clean it all up */
fclose(output_file);
free(prefix_code);
free(append_character);}/* MODIFIED This is the new compression routine. The first two 9-bit codes
* have been reserved for communication between the compressor and expander. */
compress(FILE *input, FILE *output){
unsigned int next_code=FIRST_CODE;
unsigned int string_
DWORD begin_time=0, end_time=0;
/* All purpose integer */
ratio_new,
/* New compression ratio as a percentage */
ratio_old=100;
/* Original ratio at 100% */
begin_time = GetTickCount();
for (i=0;i&TABLE_SIZE;i++)
/* Initialize the
string table first */
code_value[i]=-1;
//在前面定义的 code_value不是数组,为什么要赋值-1
printf("Compressing\n");
string_code=getc(input);
/* Get the first code 从输入文件向外面读字符 */
/* This is the main compression loop. Notice when the table is full we try
* to increment the code size. Only when num_bits == MAX_BITS and the code
* value table is full do we start to monitor the compression ratio.
while((character=getc(input)) != (unsigned)EOF)
//判断是否将输入文本中的字符读完
if (!(++bytes_in % 1000)) {
/* Count input bytes and pacifier
Used to monitor compression ratio*/
putchar('.');
index=find_match(string_code,character);
//调用find_match函数,实参是两个整数
if (code_value[index] != -1)
string_code=code_value[index];
if (next_code &= max_code ) {
code_value[index]=next_code++;
prefix_code[index]=string_
append_character[index]=
output_code(output,string_code);
/* Send out current code
调用output_code函数 */
string_code=
if (next_code & max_code) {
/* Is table Full? */
if ( num_bits & MAX_BITS) {
/* Any more bits? */
putchar('+');
max_code = MAXVAL(++num_bits);
/* Increment code size then */
else if (bytes_in & checkpoint) {
/* At checkpoint? */
if (num_bits == MAX_BITS ) {
ratio_new = bytes_out*100/bytes_ /* New compression ratio */
if (ratio_new & ratio_old) {
/* Has ratio degraded? */
output_code(output,CLEAR_TABLE); /* YES,flush string table */
putchar('C');
num_bits=INIT_BITS;
next_code=FIRST_CODE;
/* Reset to FIRST_CODE */
max_code = MAXVAL(num_bits); /* Re-Initialize this stuff */
bytes_in = bytes_out = 0;
ratio_old=100;
/* Reset compression ratio */
for (i=0;i&TABLE_SIZE;i++)
/* Reset code value array */
code_value[i]=-1;
/* NO, then save new */
ratio_old = ratio_
/* compression ratio */
checkpoint = bytes_in + CHECK_TIME;
/* Set new checkpoint */
output_code(output,string_code);
/* Output the last code */
if (next_code == max_code) {
/* Handles special case for bit */
/* increment on EOF */
putchar('+');
output_code(output,TERMINATOR);
/* Output the end of buffer code */
output_code(output,0);
/* Flush the output buffer */
output_code(output,0);
output_code(output,0);
putchar('\n');
end_time = GetTickCount();
printf("Total Time Used : %d\n", end_time - begin_time);}/* UNCHANGED from original * This is the hashing routine. */
find_match(int hash_prefix, unsigned int hash_character){
int index,
index = (hash_character && HASHING_SHIFT ) ^ hash_//符号常量HASHING_SHIFT=MAX_BITS - 8,MAX_BITS是14,具体作用是???这个地方不明白
if (index == 0 )
offset = TABLE_SIZE -
if (code_value[index] == -1 )
return(index);
if (prefix_code[index] == hash_prefix &&
append_character[index] == hash_character)
return(index);
if (index & 0)
index += TABLE_SIZE;
}}/* MODIFIED This is the modified expansion routine. It must now check for the
* CLEAR_TABLE code and know when to increment the code size. */expand(FILE *input, FILE *output){
unsigned int next_code=FIRST_CODE;
unsigned int new_
unsigned int old_
int character,
counter=0,
clear_flag=1;
/* Need to clear the code value array */
unsigned char *
char *decode_string(unsigned char *buffer, unsigned int code);
printf("Expanding\n");
while((new_code=input_code(input)) != TERMINATOR) {
if (clear_flag) {
/* Initialize or Re-Initialize */
clear_flag=0;
old_code=new_
/* The next three lines have been moved */
character=old_
/* from the original */
putc(old_code,output);
if (new_code == CLEAR_TABLE) {
/* Clear string table */
clear_flag=1;
num_bits=INIT_BITS;
next_code=FIRST_CODE;
putchar('C');
max_code = MAXVAL(num_bits);
if (++counter == 1000) {
/* Pacifier */
counter=0;
putchar('.');
if (new_code &= next_code) {
/* Check for string+char+string */
*decode_stack=
string=decode_string(decode_stack+1,old_code);
string=decode_string(decode_stack,new_code);
character = *
/* Output decoded string in reverse */
while (string &= decode_stack)
putc(*string--,output);
if (next_code &= max_code) {
/* Add to string table if not full */
prefix_code[next_code]=old_
append_character[next_code++]=
if (next_code == max_code && num_bits & MAX_BITS) {
putchar('+');
max_code = MAXVAL(++num_bits);
old_code=new_
putchar('\n');}/* UNCHANGED from original * Decode a string from the string table, storing it in a buffer. * The buffer can then be output in reverse order by the expansion * program. */char *decode_string(unsigned char *buffer, unsigned int code){
while(code & 255 ) {
*buffer++ = append_character[code];
code=prefix_code[code];
if (i++ &= 4000 ) {
printf("Error during code expansion\n");
return(buffer);} /* UNCHANGED from original * Input a variable length code. */unsigned input_code(FILE *input){
unsigned int return_
static int input_bit_count=0;
static unsigned long input_bit_buffer=0L;
while (input_bit_count &= 24 ) {
input_bit_buffer |= (unsigned long) getc(input) && (24 - input_bit_count);
input_bit_count += 8;
return_value=input_bit_buffer && (32-num_bits);
input_bit_buffer &&= num_
input_bit_count -= num_
return(return_value);}/* MODIFIED Output a variable length code. */output_code(FILE *output, unsigned int code){
static int output_bit_count=0;
static unsigned long output_bit_buffer=0L;
output_bit_buffer |= (unsigned long) code && (32 - num_bits - output_bit_count);
output_bit_count += num_
while (output_bit_count &= 8) {
putc(output_bit_buffer && 24, output);
output_bit_buffer &&= 8;
output_bit_count -= 8;
bytes_out++;
/* ADDED for compression monitoring */
在这里谢谢了
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或刚开始看算法导论,这一段看不懂,求指导~_百度作业帮
刚开始看算法导论,这一段看不懂,求指导~
输入规模为n,就是需要处理的数据量为n.那么需要用多少位数据来标记这n个数据,需要大于等于lgn位数据
您可能关注的推广后使用快捷导航没有帐号?
查看: 3389|回复: 20
尼玛,交行信用卡的账单怎么那么晦涩难懂,看不懂账单!求解释!
阅读权限10
在线时间1 小时
申卡中, 积分 17, 距离下一级还需 62 积分
在线时间1 小时
QQ截图14.jpg (76.56 KB, 下载次数: 6)
13:32 上传
看不懂啊,求解释!!!
阅读权限10
在线时间1 小时
在线时间1 小时
我有一笔4500的消费是分9期付款的,每月应该是还款500+,我已经还过一次400多的,一次100多的,现在显示的是什么,求详细解释啊。
首页不明白的就是“当前欠款金额”,就算分期付款,我每月应该是500多,这怎么显示100多。
2. 本期账单余额,这是个什么意思
3. 本期账单还款日是什么意思,必须这之前还款吗
阅读权限90
在线时间421 小时
弃我去者,昨日之日不可留;乱我心者,今日之日多烦忧
经验值8495
信用币2545
在线时间421 小时
小手一抖,积分到手,拿分走人,不要笑我~
工商牡丹金卡
阅读权限40
在线时间128 小时
在线时间128 小时
不懂,帮顶了
阅读权限90
在线时间2240 小时
经验值10223
信用币3722
在线时间2240 小时
你就按本期账单金额还就可以了,当前欠款包括未还的账单金额和未出账单金额,未出账单不管它了。和你分期的事情没有关系。分期相当于银行先把帐冲掉了,占用你的信用额度,你每月还上就可以了。
已经分期的钱从可用额度上面反应出来了。虽然你只欠100多,可是额度上面去少了4000多。
阅读权限80
在线时间270 小时
经验值5265
信用币5432
在线时间270 小时
你的分期占用额度的
阅读权限50
在线时间149 小时
经验值2336
信用币2415
在线时间149 小时
你的分期占用额度的。
不是尊前爱惜身,佯狂难免假成真
阅读权限40
在线时间141 小时
在线时间141 小时
习惯就好了,我以前用农行的,对账单很清晰,不过交行的有详细说明的。
阅读权限30
在线时间36 小时
在线时间36 小时
nanjingvisa 发表于
你就按本期账单金额还就可以了,当前欠款包括未还的账单金额和未出账单金额,未出账单不管它了。和你分期的 ...
意思是不是除了还这100多还要换上分期的钱?
阅读权限80
在线时间676 小时
经验值7907
信用币7923
在线时间676 小时
分期占用额度的
交行金凤15K -&18K&&白77K&&
中信淘宝3K -&5K& &i白10K
工行标普1K
兴业淘宝9K
建行标金10K
光大福金15K
阅读权限50
在线时间277 小时
经验值3275
信用币3473
在线时间277 小时
不懂,帮顶一下啊
阅读权限10
在线时间1 小时
在线时间1 小时
nanjingvisa 发表于
你就按本期账单金额还就可以了,当前欠款包括未还的账单金额和未出账单金额,未出账单不管它了。和你分期的 ...
我真的不好意思说,我还是没懂,又到还款的时候了,所以我又来求问了
阅读权限20
在线时间36 小时
在线时间36 小时
i_still 发表于
我真的不好意思说,我还是没懂,又到还款的时候了,所以我又来求问了
**,楼主你不会还没还吧?1月10号是你的最后还款期哎,今天都16号了!
写的很清楚啦,你这个月还需要还113块多钱。
阅读权限90
在线时间868 小时
经验值8522
信用币8074
在线时间868 小时
还120就可以了
北京,中行05(未)
阅读权限20
在线时间36 小时
在线时间36 小时
i_still 发表于
我真的不好意思说,我还是没懂,又到还款的时候了,所以我又来求问了
楼主,16号是你的账单日,不是你的还款日。你这个月的最后还款日是10号啊!
比如你15号刷的卡,每个月16号银行给你出对账单,25天后也就是10号左右要把钱还上。
你上个月16号之前一共出账113.94元(4500元分9期,每期应还524.4元,但你上个月16号之前可能已经还了400多,所以还剩113.94显示在账单里了),银行发给你的对账单写得很清楚1月10号最后还款期前要还113.94元。
你现在赶紧翻翻记录,12月16号到1月10号之间你有没有朝卡里还113.94元,没还的话你现在已经逾期了。
阅读权限130
在线时间1716 小时
经验值41291
信用币35817
在线时间1716 小时
你分期的应该在下一期账单
阅读权限90
在线时间2240 小时
经验值10223
信用币3722
在线时间2240 小时
i_still 发表于
我真的不好意思说,我还是没懂,又到还款的时候了,所以我又来求问了
你还真沉得住气,都逾期要一个礼拜了,等着交滞纳金和利息吧
按账单上面应还金额在最后还款日钱还上什么事情都没有
如果老这样的话,你的信用记录会出问题的,楼主还是别用信用卡了,给自己找麻烦
阅读权限50
在线时间236 小时
经验值2144
信用币2128
在线时间236 小时
只刷不换3年以后看结果
农行金150K
阅读权限30
在线时间20 小时
在线时间20 小时
应该还是能看懂的吧,
阅读权限100
在线时间2402 小时
经验值13593
信用币13272
在线时间2402 小时
你别管他对不对,反正他上面显示还多少,你比这个数字大就行了。
Powered by Discuz! X3&求一段数据结构算法分析 看不懂哇int LocateElem_Sq(SqList,ElemType e,Status(*compare)(ElemType,ElemType))i=1;p=L.while(i_百度作业帮
求一段数据结构算法分析 看不懂哇int LocateElem_Sq(SqList,ElemType e,Status(*compare)(ElemType,ElemType))i=1;p=L.while(i
这算法是查找线性表中是否存在e这个数.首先把P放在头指针,即m=L.elem,然后指针移动并逐个比较,即是个循环,条件是i
您可能关注的推广您还未登陆,请登录后操作!
建行卡免息期怎么计算?
日。我消费能有多少天的无息期?
高手指教!!谢谢
共有 1 位网友向您献上回答啦, 对答案满意?赶快给出你的好评,感谢他们吧!
您的建行信用卡的账单日是每月19日,账单日后第二十天是还款日。
如果4月26日消费,就应该记入下一个账单日 ---- 即5月19日的账单,还款日应该是5月19日之后的20天 -- 即6月8日。
免息期是4月26日至6月7日,共计 5 + 31 + 7 = 43天。
免息期最长的,是在账单日的次日 ---- 即20日交易,还款日就是账单日(次月19日)之后的20天 ---- 即隔月的8日前后,免息期共计有50天。
免息期最短的,是在账单日的当天 ---- 即19日交易,还款日就是账单日(当天)之后的20天 ---- 即次月的8日前后,免息期共计只有20天。
大家还关注}

我要回帖

更多关于 求魔看不懂 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信