一道acm题 题目是Number Triangle 我的程序样例可以通过 但是无法AC 提示wa 不懂有什么问题了

一道acm题 题目是Number Triangle 我的程序样例可以通过 但是无法AC 提示wa 不懂有什么问题了

题目
一道acm题 题目是Number Triangle 我的程序样例可以通过 但是无法AC 提示wa 不懂有什么问题了
Problem Description
Consider the number triangle shown below.Write a program that calculates the highest sum of numbers that can be passed on a route that starts at the top and ends somewhere on the base.Each step can go either diagonally down to the left or diagonally down to the right.
7
3 8
8 1 0
2 7 4 4
4 5 2 6 5
In the sample above,the route from 7 to 3 to 8 to 7 to 5 produces the highest sum:30.
Input
There are multiple test cases.The first line of each test case contains R (1 sz;
int **arr=new int *[sz];
for(int i=0;i=0;i--)
{
for(int j=0;jarr[i+1][j+1]?arr[i+1][j]:arr[i+1][j+1]);
arr[i][j]=arr[i][j]+max;
}
}
cout
答案
这道题相当恶心.会多次输入testcase你的程序改成这样就AC了.#include<iostream>#include<iomanip>using namespace std;int main(){int n;double a,b,c,d,e,f,x,y;while(1){cin>>n;if(n==0) ...
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
热门考点

超级试练试题库

© 2017-2019 超级试练试题库,All Rights Reserved.