Merge lp:~yani-kathy/marathon/kbert-yani into lp:marathon

Proposed by Yanina Aular (Vauxoo)
Status: Merged
Merged at revision: 32
Proposed branch: lp:~yani-kathy/marathon/kbert-yani
Merge into: lp:marathon
Diff against target: 66 lines (+49/-0)
3 files modified
.bzrignore (+1/-0)
kbert/in.txt (+10/-0)
kbert/kbert.cpp (+38/-0)
To merge this branch: bzr merge lp:~yani-kathy/marathon/kbert-yani
Reviewer Review Type Date Requested Status
Yanina Aular (Vauxoo) (community) Approve
Review via email: mp+191151@code.launchpad.net

Description of the change

Se termina el ejercicio del juego kbert, se ignoran los archivos a.out ya que son los ejecutables estandar.

To post a comment you must log in.
Revision history for this message
Yanina Aular (Vauxoo) (yanina-aular) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file '.bzrignore'
--- .bzrignore 1970-01-01 00:00:00 +0000
+++ .bzrignore 2013-10-15 10:49:41 +0000
@@ -0,0 +1,1 @@
1**/a.out
02
=== added directory 'kbert'
=== added file 'kbert/a.out'
1Binary files kbert/a.out 1970-01-01 00:00:00 +0000 and kbert/a.out 2013-10-15 10:49:41 +0000 differ3Binary files kbert/a.out 1970-01-01 00:00:00 +0000 and kbert/a.out 2013-10-15 10:49:41 +0000 differ
=== added file 'kbert/in.txt'
--- kbert/in.txt 1970-01-01 00:00:00 +0000
+++ kbert/in.txt 2013-10-15 10:49:41 +0000
@@ -0,0 +1,10 @@
15
25
33 8
49 1 0
51 6 5 5
62 8 1 9 1
72
81
998 97
100
011
=== added file 'kbert/kbert.cpp'
--- kbert/kbert.cpp 1970-01-01 00:00:00 +0000
+++ kbert/kbert.cpp 2013-10-15 10:49:41 +0000
@@ -0,0 +1,38 @@
1#include <iostream>
2
3using namespace std;
4
5int num, m[102][102], maxi = 0, acum=0;
6/*Recorrido en preorden*/
7int kbert(int i, int j){
8
9 if(i == num || j > i){
10 if( maxi < acum)
11 maxi = acum;
12 return 0;
13 }
14 acum += m[i][j];
15 kbert(i+1, j+1);
16 kbert(i+1, j);
17 acum -= m[i][j];
18}
19
20
21int main(){
22
23 cin >> num;
24
25 while(num != 0){
26
27 for(int i = 0; i < num; i++)
28 for(int j = 0; j <= i; j++)
29 cin >> m[i][j];
30
31 kbert(0,0);
32 cout << maxi << endl;
33 maxi = 0; acum = 0;
34 cin >> num;
35 }
36
37 return 0;
38}

Subscribers

People subscribed via source and target branches

to all changes: