#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<vector> #include<set> #include<map> usingnamespace std; #define MAXN 200006 int n , l , r; intmain(){ cin >> n >> l >> r; int mn , mx; mn = mx = 0; for( int i = l - 1 ; i >= 0 ; -- i ) mn += ( 1 << i ); mn += ( n - l ); for( int i = r - 1 ; i >= 0 ; -- i ) mx += ( 1 << i ); mx += ( n - r ) * ( 1 << r - 1 ); cout << mn << ' ' << mx << endl; }
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<stack> usingnamespace std; #define int long long #define MAXN 2006 #define P 998244853 int k[MAXN][MAXN] , dp[MAXN][MAXN]; int J[MAXN * 10] , inv[MAXN * 10] , invJ[MAXN * 10]; int n , m; intC( int x , int y ){ return J[x] * invJ[y] % P * invJ[x - y] % P; } signedmain(){ cin >> n >> m; inv[0] = inv[1] = J[0] = invJ[0] = J[1] = invJ[1] = 1; for( int i = 2; i < 10 * MAXN ; ++ i ) J[i] = J[i - 1] * i , J[i] %= P , inv[i] = ( P - P/i )*inv[P%i] % P , invJ[i] = inv[i] * invJ[i - 1] % P; for( int i = 0 ; i <= m ; ++ i ) k[0][i] = 1; for( int i = 1 ; i <= n ; ++ i ) for( int j = 1 ; j <= m ; ++ j ) if( i <= j ) k[i][j] = k[i - 1][j] + k[i][j - 1] , k[i][j] %= P; for( int i = 0 ; i <= n ; ++ i ) dp[i][0] = i; for( int i = 1 ; i <= n ; ++ i ) { for( int j = 1 ; j <= m ; ++ j ) dp[i][j] = ( ( dp[i - 1][j] + C( i + j - 1 , j ) ) % P + ( dp[i][j - 1] - ( C( i + j - 1 , i ) - k[i][j - 1] + P ) % P + P ) % P ) % P; } cout << dp[n][m] << endl; }