hurriedly% 2018-11-11 13:31 采纳率: 100%
浏览 272

二维数组中最大采集和的 c 阶运动

I've been having trouble with a problem, something like this:

I have a 2D array where each position is filled with a certain number samples (represented by ints). There are nanorobots, each going in a straight line through a part of a line of column (each with a pre-specified way), collecting all samples along the way. If a nanorobot collects samples on a position, the position becomes contaminated and if another robot comes there, it gets confused and stops. I can deploy the robots in any order, and each robot starts working only after the previous one has stopped.

With this information, I want to find the order in which the highest number of samples is collected.

Any help with the problem would be appreciated, as I am pretty stumped. I have a general idea of how it's done, but can't seem to move forward. One thing specifically is how do I mark which places a robot has been to so that i know where other robots should stop if they come there, every solution I've come up with seems really slow. Thanks.

转载于:https://stackoverflow.com/questions/53249237/c-order-of-movement-in-a-2d-array-for-maximum-sum-collected

  • 写回答

1条回答

  • 笑故挽风 2018-11-11 14:23
    关注

    To help you developing your algorithms, I provide you with a possible data structure:

    typedef struct LIST {
        int sample;
        struct LIST *next;
    } t_list;
    
    typedef struct ITEM {
        t_list *samples;
        int visited;
    } t_item;
    
    t_item items[10][10];
    

    This defines an array of 10x10 items. Each item has a list of samples and an indicator that it has been visited ("contaminated"). A list element (a sample) has the sample value and a pointer to the next list element (the next sample). I hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退