-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBricksGame.java
57 lines (48 loc) · 1.56 KB
/
BricksGame.java
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* IMPORTANT: Multiple classes and nested static classes are supported */
/*
* uncomment this if you want to read input.
//imports for BufferedReader
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import for Scanner and other utility classes
import java.util.*;
*/
import java.util.Scanner;
// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
class TestClass {
public static void main(String args[] ) throws Exception {
/* Sample code to perform I/O:
* Use either of these methods for input
//BufferedReader
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String name = br.readLine(); // Reading input from STDIN
System.out.println("Hi, " + name + "."); // Writing output to STDOUT
//Scanner
Scanner s = new Scanner(System.in);
String name = s.nextLine(); // Reading input from STDIN
System.out.println("Hi, " + name + "."); // Writing output to STDOUT
*/
// Write your code here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int flag =0;
int p,b_rem=n,m;
for(int count=1;count<=n/2;count++ ){
p = count;
b_rem = b_rem - p;
if (b_rem <=0){
flag=1;
break;
}
m = count*2;
b_rem = b_rem - m;
if (b_rem <=0){
flag=0;
break;
}} if(flag==1) {
System.out.println("Patlu");
}else {
System.out.println("Motu");
}
}
}