#include
int fact (int m) {
if(m < 0) return 0;
int res = 1;
for(int i = 1; i <= m; ++i)
res *= i;
return res;
}
int com(int m, int r) {
if(m < 0 || r < 0 || m < r) return 0;
int res = 1;
if(r < m - r) r = m - r;
for(int i = m; i > r; --i)
res *= i;
return res / fact( m - r);
}
int main()
{
printf("%d\n", com(4, 2));
printf("%d\n", com(6, 4));
printf("%d\n", com(8, 7));
return 0;
}
#include
#define MAXSIZE 100
int fact(int n)
{
if(n < 0 ) return -1;
int res = 1;
for(int i = 1; i <= n; ++i)
res *= i;
return res;
}
int com(int m, int r)
{
if( m <= r )
return -1;
else
return fact(m) / fact(r) / fact(m-r);
}
int main()
{
printf("%d\n%d\n%d\n\n", com(4,2), com(6,4), com(8,7));
int a[4][4];
int i, j, x;
for(i = 0; i < 4; ++i)
for(j = 0; j < 4; ++j)
scanf("%d", &a[i][j]);
int tag = 0;
scanf("%d", &x);
for(i = 0; i < 4; ++i){
for(j = 0; j < 4; ++j)
if( a[i][j] == x ){
tag = 1;
break;
}
if( tag == 1 )
break;
}
printf("(%d,%d)\n", i, j);
return 0;
}
package edu.xaufe.bean;
public class Person {
private String id;
private String password;
private String role;
public Person(String id, String password, String role) {
super();
this.id = id;
this.password = password;
this.role = role;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
}