1
//
1079 C++ Accepted 0.031 917 KB URAL
2
3 #include < stdio.h >
4 #include < stdlib.h >
5 #include < string .h >
6
7 typedef long long llong ;
8
9 const int size = 110000 ;
10 llong data[size] ;
11
12 int inn ;
13
14 int main()
15 {
16 data[ 0 ] = 0 ; data[ 1 ] = 1 ;
17 // data[2] = 1 ; data[3] = 2 ;
18 while ( scanf( " %d " , & inn ) != EOF && inn )
19 {
20 llong maxval = 1 ;
21 for ( int i = 2 ; i <= inn; i ++ )
22 {
23 if ( 0 == (i & 1 ) ) data[i] = data[i / 2 ] ;
24 else data[i] = data[i / 2 ] + data[i / 2 + 1 ] ;
25
26 if ( maxval < data[i] ) maxval = data[i] ;
27 }
28
29 printf( " %I64d\n " , maxval ) ;
30 }
31
32 return 0 ;
33 }
2
3 #include < stdio.h >
4 #include < stdlib.h >
5 #include < string .h >
6
7 typedef long long llong ;
8
9 const int size = 110000 ;
10 llong data[size] ;
11
12 int inn ;
13
14 int main()
15 {
16 data[ 0 ] = 0 ; data[ 1 ] = 1 ;
17 // data[2] = 1 ; data[3] = 2 ;
18 while ( scanf( " %d " , & inn ) != EOF && inn )
19 {
20 llong maxval = 1 ;
21 for ( int i = 2 ; i <= inn; i ++ )
22 {
23 if ( 0 == (i & 1 ) ) data[i] = data[i / 2 ] ;
24 else data[i] = data[i / 2 ] + data[i / 2 + 1 ] ;
25
26 if ( maxval < data[i] ) maxval = data[i] ;
27 }
28
29 printf( " %I64d\n " , maxval ) ;
30 }
31
32 return 0 ;
33 }