-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFuckingPi.java
More file actions
44 lines (34 loc) · 956 Bytes
/
FuckingPi.java
File metadata and controls
44 lines (34 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.io.*;
/**
* Write a description of class Main here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class FuckingPi
{
/**
* Constructor for objects of class Main
*/
public static void main(String[] args) throws IOException
{
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(b.readLine());
int k = Integer.parseInt(b.readLine());
System.out.println(f(1, n, k));
}
public static int f(int start, int n, int k)
{
if(k == 1)return 1;
else if(k == n) return 1;
else
{
int sum = 0;
for(int i = start; i<n/k+1; i++)
{
sum+=f(i, n-i, k-1);
}
return sum;
}
}
}