高分求写r-连续位匹配算法的程序

高分求写r-连续位匹配算法的程序,第1张

#include <stdio.h>

#define MATCH 1

#define NOMATCH 0

#define ERROR -1

int main (void)

{

int nMatch

nMatch = r_contiguousbits("100100"毁茄, "100001", 3)

if(MATCH == nMatch)

printf("Match\n")

else if(NOMATCH == nMatch)

printf("NOMATCH\n")

else

printf("Error\n")

return 0

}

int r_contiguousbits(char s1[],char s2[],const int r) /*定义匹配函数*/

{

int nIndex = 0

int nIndex2 = 0

int nMatch = 0

if( r <= 0)

return ERROR

for(nIndex = 0nIndex <strlen(s1)nIndex++)

{

for(nIndex2 = 0nIndex2 <strlen(s2) - rnIndex2++)

{

for(nMatch = 0nMatch <rnMatch++)

{

if(s1[nIndex + nMatch] != s2[nIndex2 + nMatch])

break

}

if(nMatch == r)

return MATCH

}

}

return NOMATCH

}

/* 兄弟带余大,这可花了我10分钟蠢竖的时间在linux下编写的喔 , 答案满意的话请...不够好的话请追问&_&*/

你是不是用R Gui安岩顷装的,提示已经说了缺少quadprog依赖包,

用R Gui安装的话需要先把依赖包一个个安装上,比较麻烦,

可以在Rstudio上安装,

install.packages('tseries')

also installing the dependencies ‘quadprog’, ‘zoo’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/quadprog_1.5-5.zip'

Content type 'application/zip' length 52439 bytes (51 KB)

downloaded 51 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/zoo_1.7-13.zip'

Content type 'application/zip' length 899932 bytes (878 KB)

downloaded 878 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/tseries_0.10-35.zip'

Content type 'application/zip' length 327381 bytes (319 KB)

downloaded 319 KB

package ‘quadprog’ successfully unpacked and MD5 sums checked

package ‘zoo’ successfully unpacked and MD5 sums checked

package ‘tseries’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in

C:\Users\yuexf\AppData\Local\Temp\RtmpqqGpKz\downloaded_packages

>library(tseries)

‘tseries’ version: 0.10-35

‘tseries’兄配 is a package for time series analysis and computational finance.

See ‘library(help="tseries")’ for details.

它会自动把依赖包粗尘陆给你安装上


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12374393.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存