求注释以下C语言代码
#include"contiki.h"#include"shell.h"#include"serial-shell.h"#include"collect-view.h"#...
#include "contiki.h"
#include "shell.h"
#include "serial-shell.h"
#include "collect-view.h"
#define WITH_COFFEE 0
/*---------------------------------------------------------------------------*/
PROCESS(collect_view_shell_process, "Contiki Collect View Shell");
AUTOSTART_PROCESSES(&collect_view_shell_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(collect_view_shell_process, ev, data)
{
PROCESS_BEGIN();
serial_shell_init();
shell_blink_init();
#if WITH_COFFEE
shell_file_init();
shell_coffee_init();
#endif /* WITH_COFFEE */
/* shell_download_init(); */
/* shell_rime_sendcmd_init(); */
/* shell_ps_init(); */
shell_reboot_init();
#include "contiki.h"
#include "shell.h"
#include "serial-shell.h"
#include "collect-view.h"
#define WITH_COFFEE 0
/*---------------------------------------------------------------------------*/
PROCESS(collect_view_shell_process, "Contiki Collect View Shell");
AUTOSTART_PROCESSES(&collect_view_shell_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(collect_view_shell_process, ev, data)
{
PROCESS_BEGIN();
serial_shell_init();
shell_blink_init();
#if WITH_COFFEE
shell_file_init();
shell_coffee_init();
#endif /* WITH_COFFEE */
/* shell_download_init(); */
/* shell_rime_sendcmd_init(); */
/* shell_ps_init(); */
shell_reboot_init();
shell_rime_init();
shell_rime_netcmd_init();
/* shell_rime_ping_init(); */
/* shell_rime_debug_init(); */
/* shell_rime_debug_runicast_init(); */
shell_powertrace_init();
/* shell_base64_init(); */
shell_text_init();
shell_time_init();
/* shell_sendtest_init(); */
#if CONTIKI_TARGET_SKY
shell_sky_init();
#endif /* CONTIKI_TARGET_SKY */
shell_collect_view_init();
PROCESS_END();
}
/*---------------------------------------------------------------------------*/ 展开
#include "shell.h"
#include "serial-shell.h"
#include "collect-view.h"
#define WITH_COFFEE 0
/*---------------------------------------------------------------------------*/
PROCESS(collect_view_shell_process, "Contiki Collect View Shell");
AUTOSTART_PROCESSES(&collect_view_shell_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(collect_view_shell_process, ev, data)
{
PROCESS_BEGIN();
serial_shell_init();
shell_blink_init();
#if WITH_COFFEE
shell_file_init();
shell_coffee_init();
#endif /* WITH_COFFEE */
/* shell_download_init(); */
/* shell_rime_sendcmd_init(); */
/* shell_ps_init(); */
shell_reboot_init();
#include "contiki.h"
#include "shell.h"
#include "serial-shell.h"
#include "collect-view.h"
#define WITH_COFFEE 0
/*---------------------------------------------------------------------------*/
PROCESS(collect_view_shell_process, "Contiki Collect View Shell");
AUTOSTART_PROCESSES(&collect_view_shell_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(collect_view_shell_process, ev, data)
{
PROCESS_BEGIN();
serial_shell_init();
shell_blink_init();
#if WITH_COFFEE
shell_file_init();
shell_coffee_init();
#endif /* WITH_COFFEE */
/* shell_download_init(); */
/* shell_rime_sendcmd_init(); */
/* shell_ps_init(); */
shell_reboot_init();
shell_rime_init();
shell_rime_netcmd_init();
/* shell_rime_ping_init(); */
/* shell_rime_debug_init(); */
/* shell_rime_debug_runicast_init(); */
shell_powertrace_init();
/* shell_base64_init(); */
shell_text_init();
shell_time_init();
/* shell_sendtest_init(); */
#if CONTIKI_TARGET_SKY
shell_sky_init();
#endif /* CONTIKI_TARGET_SKY */
shell_collect_view_init();
PROCESS_END();
}
/*---------------------------------------------------------------------------*/ 展开
1个回答
2016-05-21
展开全部
这是一个背包问题,该算法已经是最简单的了,还有递归算法,我觉得更麻烦。对你的代码进行解释如下://背包问题:有m件物品和一个承重为t的背包。第i件物品的重量是w[i],价值是v[i]。//求解将哪些物品装入背包可使这些物品的重量总和不超过背包承重量t,且价值总和最大。#include #include #include int f[1010],w[1010],v[1010];//f记录不同承重量背包的总价值,w记录不同物品的重量,v记录不同物品的价值int max(int x,int y){//返回x,y的最大值 if(x>y) return x; return y;}int main(){ int t,m,i,j; memset(f,0,sizeof(f)); //总价值初始化为0 scanf("%d %d",&t,&m); //输入背包承重量t、物品的数目m for(i=1;i=w[i];j--){ f[j]=max(f[j-w[i]]+v[i],f[j]); //在放入第i个物品前后,检验不同j承重量背包的总价值,如果放入第i个物品后比放入前的价值提高了,则修改j承重量背包的价值,否则不变 } } printf("%d",f[t]); //输出承重量为t的背包的总价值 printf("\n"); getch(); return 0;}
追问
那上述程序大致是什么意思,若均为一些传感器节点的程序,实现的是什么功能?兄弟,急求,明天就要用了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询