paste bin
Author
Language
C++
Plain text
Accesslog
Action script
Ada
Apache
Arduino
Armasm
Autohotkey
Awk
Bash
Basic
Brainfuck
C
Clojure
Cmake
C#
css
D
Delphi
Dockerfile
Erlang
Fortran
F#
Gauss
Go
Gradle
Graphql
Groovy
Haskell
Ini
Java
JavaScript
json
Julia
Kotlin
Lasso
LaTeX
Leaf
lisp
llvm
Lua
Makefile
Markdown
Mathematica
Matlab
Nginx
Objective-C
Ocaml
Oxygene
Perl
PgSQL
php
Powershell
Processing
Profile
Properties
Puppet
Purebasic
Python
Q
QML
R
Ruby
Rust
Scala
Scheme
Scilab
Shell
Smalltalk
SQL
Swift
Typescript
VB.NET
VB Script
Verilog
Vim
Wasm
x86asm
Xml
Xquery
Yaml
source code:
#include <cstdio> #include <algorithm> using std::max; int main(void) { int **a; int i,j,N; scanf("%d",&N); a=new int* [N]; for(i=0;i<N;i++) a[i]=new int [i]; for(i=0;i<N;i++) { for(j=0;j<=i;j++) scanf("%d",&a[i][j]); } for(i=N-2;i>=0;i--) { for(j=0;j<=i;j++) { a[i][j]+=max(a[i+1][j],a[i+1][j+1]); } } printf("%d\n",a[0][0]); for(i=0;i<N;i++) delete [] a[i]; delete [] a; return 0; }
comment: