1.

/**
 *
 * Problem #10219 - Find the ways !
 * http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=14&page=show_problem&problem=1160

 *
 * @author Mariya Vlaseva
 *
 * Status : Accepted
 * Runtime: 0.012
 */

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define pi acos(-1.0)
#define N 1000000
#define LL long long
using namespace std;

int main ()
{
    LL n, k;

    while ( cin >> n >> k ) {
        double number = 0;

        if ( k > n - k ) {
            for ( LL i = k + 1; i <= n; i++ )
                number += (log10 (i) - log10 (n - i + 1));
        }
        else {
            for ( LL i = n - k + 1; i <= n; i++ )
                number += (log10 (i) - log10 (n - i + 1));
        }

        number = floor (number) + 1;

        printf ("%0.lf\n", number);
    }

    return 0;
}



2.


package acm_10219_find_the_ways;

import java.util.Scanner;

/**
 * FWP, AusgewŠhlte Probleme aus dem ACM Programming Contest, SS10
 * Problem: acm_10219_find_the_ways
 * Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=14&page=show_problem&problem=1160
 *
 * @author Martin Lambeck
 * @version 1.0, 14.08.2010
 *
 * Method : ad hoc
 * Status : Accepted
 * Runtime: 0.184
 */


public class Main
{
    static Scanner sc = new Scanner(System.in);

    public static void main(String... args)
    {
        while (testcase())
            ;
    }

    public static boolean testcase()
    {
        if (!sc.hasNextInt())
            return false;

        double num = 0;
        double denom = 0;
       
        int a = sc.nextInt();
        int b = sc.nextInt();
       
        b = Math.min(b, a-b);

        for (int i = 0; i < b; i++)
        {
            num += Math.log10(a-i);
            denom += Math.log10(i+1);
        }

        int d = ((int) (num-denom)) + 1;
       
        System.out.println(d);

        return true;
    }

    static void work()
    {

    }
}