File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 9c21673e3fc960714e143a55f8f0b05522ca850c
2
+ refs/heads/master: 93dcb9fb6b696e65e24c9a9a37658bf43f42adc3
Original file line number Diff line number Diff line change @@ -5,10 +5,9 @@ import vec;
5
5
6
6
fn fannkuch ( n : int ) -> int {
7
7
fn perm1init ( i : uint ) -> int { ret i as int ; }
8
- let perm1init_ = perm1init; // Rustboot workaround
9
8
10
9
let perm = vec:: init_elt_mut ( 0 , n as uint ) ;
11
- let perm1 = vec:: init_fn_mut ( perm1init_ , n as uint ) ;
10
+ let perm1 = vec:: init_fn_mut ( perm1init , n as uint ) ;
12
11
let count = vec:: init_elt_mut ( 0 , n as uint ) ;
13
12
let f = 0 ;
14
13
let i = 0 ;
@@ -43,7 +42,10 @@ fn fannkuch(n: int) -> int {
43
42
44
43
let go = true ;
45
44
while go {
46
- if r == n { log ( debug, checksum) ; ret flips; }
45
+ if r == n {
46
+ std:: io:: println ( #fmt ( "%d" , checksum) ) ;
47
+ ret flips;
48
+ }
47
49
let p0 = perm1[ 0 ] ;
48
50
i = 0 ;
49
51
while i < r { let j = i + 1 ; perm1[ i] = perm1[ j] ; i = j; }
@@ -57,6 +59,10 @@ fn fannkuch(n: int) -> int {
57
59
}
58
60
59
61
fn main ( args : [ str ] ) {
60
- let n = 7 ;
61
- #debug ( "Pfannkuchen(%d) = %d" , n, fannkuch ( n) ) ;
62
+ let n = if vec:: len ( args) == 2 u {
63
+ int:: from_str ( args[ 1 ] )
64
+ } else {
65
+ 10
66
+ } ;
67
+ std:: io:: println ( #fmt ( "Pfannkuchen(%d) = %d" , n, fannkuch ( n) ) ) ;
62
68
}
You can’t perform that action at this time.
0 commit comments