当前位置: 首页 > news >正文

10常用的网络营销方法长沙网站优化指导

10常用的网络营销方法,长沙网站优化指导,医联体网站建设,自己做网站要办手续吗[USACO1.5] [IOI1994]数字三角形 Number Triangles 题目描述 观察下面的数字金字塔。 写一个程序来查找从最高点到底部任意处结束的路径#xff0c;使路径经过数字的和最大。每一步可以走到左下方的点也可以到达右下方的点。 在上面的样例中#xff0c;从 7 → 3 → 8 →…[USACO1.5] [IOI1994]数字三角形 Number Triangles 题目描述 观察下面的数字金字塔。 写一个程序来查找从最高点到底部任意处结束的路径使路径经过数字的和最大。每一步可以走到左下方的点也可以到达右下方的点。 在上面的样例中从 7 → 3 → 8 → 7 → 5 7 \to 3 \to 8 \to 7 \to 5 7→3→8→7→5 的路径产生了最大权值。 输入格式 第一个行一个正整数 r r r ,表示行的数目。 后面每行为这个数字金字塔特定行包含的整数。 输出格式 单独的一行,包含那个可能得到的最大的和。 样例 #1 样例输入 #1 5 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5样例输出 #1 30提示 【数据范围】 对于 100 % 100\% 100% 的数据 1 ≤ r ≤ 1000 1\le r \le 1000 1≤r≤1000所有输入在 [ 0 , 100 ] [0,100] [0,100] 范围内。 代码 #include stdio.h #include stdlib.h int max(int a, int b); // 用于比较两个数的大小的函数 #define MAX 10000 int dp[MAX][MAX]; // 定义一个二维数组用于存储金字塔和动态规划的状态int main(int argc, char *argv[]) {int r, i, j;scanf(%d, r);for (i 1; i r; i){for (j 1; j i; j){scanf(%d, dp[i][j]); // 读取该位置的值}}for (i r - 1; i 1; i--) // 从倒数第二行开始逐行向上{for (j 1; j i; j){// 选择下方或者右下方的较大值然后加上当前位置的值dp[i][j] max(dp[i 1][j], dp[i 1][j 1]);}}printf(%d\n, dp[1][1]); // 输出顶部的值即最大值return 0; }int max(int a, int b) // 用于比较两个数的大小的函数 {if (a b){return a;}else{return b;} }[USACO11JAN] Profits S 题目描述 The cows have opened a new business, and Farmer John wants to see how well they are doing. The business has been running for N (1 N 100,000) days, and every day i the cows recorded their net profit P_i (-1,000 P_i 1,000). Farmer John wants to find the largest total profit that the cows have made during any consecutive time period. (Note that a consecutive time period can range in length from one day through N days.) Help him by writing a program to calculate the largest sum of consecutive profits. 奶牛们开始了新的生意它们的主人约翰想知道它们到底能做得多好。这笔生意已经做了N1≤N≤100,000天每天奶牛们都会记录下这一天的利润Pi-1,000≤Pi≤1,000。 约翰想要找到奶牛们在连续的时间期间所获得的最大的总利润。注连续时间的周期长度范围从第一天到第N天。 请你写一个计算最大利润的程序来帮助他。 输入格式 * Line 1: A single integer: N * Lines 2…N1: Line i1 contains a single integer: P_i 输出格式 * Line 1: A single integer representing the value of the maximum sum of profits for any consecutive time period. 样例 #1 样例输入 #1 7 -3 4 9 -2 -5 8 -3样例输出 #1 14提示 The maximum sum is obtained by taking the sum from the second through the sixth number (4, 9, -2, -5, 8) 14. 代码 #include stdio.h #include stdlib.h int max(int a, int b); // 比较两个数的大小的函数 #define MAXN 200000int main(int argc, char *argv[]) {int N, i, P[MAXN], max_P;int dp[MAXN]; // 表示以第i天结束的最大连续子序列的和scanf(%d, N);for (i 1; i N; i){scanf(%d, P[i]); // 每天的利润}dp[1] P[1]; // 初始化dp[1]为第一天的利润max_P dp[1]; // 记录最大的利润for (i 2; i N; i){dp[i] max(dp[i - 1] P[i], P[i]); // 状态转移方程max_P max(max_P, dp[i]); // 更新最大利润}printf(%d, max_P);return 0; }int max(int a, int b) // 比较两个数的大小的函数 {if (a b){return a;}else{return b;} }
http://www.hkea.cn/news/14382185/

相关文章:

  • 推广网站有哪些厦门推广平台较好的
  • 用户注册和登录网站怎么做的网站有标题
  • 系统网站设计温州网站建设方案托管
  • 网站建设管理情况汇报wordpress自带有用参数
  • 南昌做网站哪家专业营销工具有哪些
  • asp网站默认后台景点网站设计与制作
  • 手机主题如何自己制作网站长沙制作网页的基本步骤
  • 手机网站域名新闻发布会方案
  • 杭州做网站设计公司网站备案每年一次
  • 晋江做网站的公司哪家好淘宝网站用什么语言做的
  • 企业网站的总体设计有哪些网站建设工作室
  • 泉州网站建设-泉州网站建设公司网站开发需求模板模板
  • 房地产公司网站模板wordpress 预加载
  • 网站推广的策略有哪些响应式网站用什么单位
  • 织梦网站怎样做seojsp网站开发 pdf
  • 新郑龙湖网站建设银川网站建设效果
  • 审计网站建设毕业设计php网站开发工程师招聘会
  • 电子毕业设计网站建设吾爱源码
  • 深圳哪家网站建设好网站开发上市公司
  • 广州市网站建设科技进销存永久免费
  • 数据查询网站上海品划网站建设有限公司
  • 做网站的图片的内存网站怎么加关键词做优化
  • 做网站付费流程长春网站建设技术托管
  • 中文旅游网站html模板顺德网站建设多少钱
  • 6网站建设设计qq空间刷赞网站推广
  • 代理企业网站备案大气蓝色企业网站模板
  • 图形网站建设软件杰商网西安网站建设
  • 做响应式网站用什么框架关于申请网站建设
  • 网站开发前端制作中装建设装饰有限公司
  • 建网站系统能换吗老哥们给个uc能看的