1.

/**
* ACM Training 2009
* ACM Problem #10219 Find the ways
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=14&problem=1160&mosmsg=Submission+received+with+ID+7616277
*
* @author Felix Dietrich
* @version 1.0, 12/10/2009
*
* Methode: logarithmus
* Status : Accepted
* Runtime: 0.092
*/

import java.util.Scanner;

public class Main
{
public static void main(String... s)
{
Scanner sc = new Scanner(System.in);

int n, k;
double number;

while (sc.hasNext())
{
n = sc.nextInt();
k = sc.nextInt();

number = 0;
//log(n!) = log(n)+log(n-1)+...+log(1)
if (k < n - k)
{
for (int i = n - k + 1; i <= n; i++)
number += Math.log10(i);
for (int i = 1; i <= k; i++)
number -= Math.log10(i);
} else
{
for (int i = k + 1; i <= n; i++)
number += Math.log10(i);
for (int i = 1; i <= n - k; i++)
number -= Math.log10(i);
}

System.out.println((int) (Math.floor(number) + 1));
}
}
}

2.

/**
* ACM programming Contest WS 08/09
* UVa Status: Accepted
* Run Time: 0.000
* Programming Language: C
* @author Doina Logofatu logofatu@hm.edu
*/

/*
Anzahl der Ziffern der Zahl N ist: floor(log10(N)) + 1
Allgemein: log10(AB) = log10(A) + log10(B), log10(A/B) = log10(A) - log10(B)
Man schreibt die log10(Kombinationen-Formel) mit Hilfe der Addition & Substraktion
*/

#include <stdio.h>
#include <math.h>

int main() {

unsigned long long n, k;
unsigned long long i;
register double s;

while(scanf("%llu %llu", &n, &k) == 2){
s = 0;
if(k>n-k) k=n-k;
for (i=1; i<k; i++) s -= log10(i+1);
for (i=0; i<k; i++) s += log10(n-i);
printf("%d\n", (int)floor(s)+1);
}

return 0;
}