Binomial_true.c

loading
details
attribute value
description
owner Johannes Waldmann
uploaded 2017-08-17 03:45:16.0
disk size 1004 Bytes
downloadable true
type
attribute value
name no_type
processor id 1
description this is the default benchmark type for rejected benchmarks and benchmarks that are not associated with a type.
owning community none
loading contents
// public class Binomial {
    
    // public static int fact(int n) {
	// if (n <= 0) return 1;
	// else return n * fact(n - 1);
    // }

    // public static int binomialCoefficient(int n, int k) {
	// return fact(n) / (fact(k) * fact(n - k));
    // }

    // public static void main(String args[]) {
	// for (int n = 0; n <= args.length; n++)
	    // for (int k = 0; k <= args.length; k++)
		// if (k <= n) binomialCoefficient(n, k);
		// else binomialCoefficient(k, n);
    // }
	
	
// }

extern int __VERIFIER_nondet_int(void);

int fact(int n) {
	if (n <= 0) return 1;
	else return n * fact(n - 1);
}
	
int binomialCoefficient(int n, int k) {
	return fact(n) / (fact(k) * fact(n - k));
}

int main() {
	int x = __VERIFIER_nondet_int();
	if(x < 0)
		return 0;
	int y = __VERIFIER_nondet_int();
	if(y < 0) 
		return 0;
	int z = __VERIFIER_nondet_int();
	for (int n = 0; n <= x; n++)
	    for (int k = 0; k <= x; k++)
		if (k <= n) binomialCoefficient(n, k);
		else binomialCoefficient(k, n);
    }
popout

content may be truncated. 'popout' for larger text window.

actions get anonymous link download benchmark