Skip to content

Instantly share code, notes, and snippets.

@chanjungkim
Created July 15, 2017 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chanjungkim/71436a73281c0a0565382571431f38c2 to your computer and use it in GitHub Desktop.
Save chanjungkim/71436a73281c0a0565382571431f38c2 to your computer and use it in GitHub Desktop.
2775 bunyu
import java.util.Scanner;
class Main{
static long[][] d = new long[15][15];
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
int[][] tCase = new int[t][2];
for(int i = 0 ; i < t ; i++){
tCase[i][0]=sc.nextInt();
tCase[i][1]=sc.nextInt();
go(tCase[i][0], tCase[i][1]);
}
}
public static void go(int a, int b){
int sum;
for(int i = 1 ; i <= b ; i++){
d[0][i]=i;
}
for(int i = 1; i <= a ; i++){
sum=0;
int j=1;
for(; j <= b ; j++){
sum+=d[i-1][j];
d[i][j]=sum;
}
}
System.out.println(d[a][b]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment