-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path01- Welcome to CodeRit fun game
78 lines (59 loc) · 1.34 KB
/
01- Welcome to CodeRit fun game
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
This is an *easy* level question , which requires you to just *Read The Problem Statement Thoroughly*.
It is pretty obvious that the swing's actual movement willl be in the direction in which the weight is more.
But.....
The twist is that you need to print the *Opposite* Direction.
As the question states
you need to print *Left* if the Swing Moves *Right* and the vice-versa case.
We print the same direction only in case that the swing is *Balanced*
The Implementations are as follows
**C++ :**
cpp20
#include <iostream>
using namespace std;
int main() {
long int a,b;
cin>>a>>b;
if(a<b){
cout<<"Left"<<endl;
}
else if(a>b){
cout<<"Right"<<endl;
}
else{
cout<<"Balanced"<<endl;
}
return 0;
}
*PYTHON :*
python3
s=input()
a,b=s.split()
a=int(a)
b=int(b)
if a<b:
print("Left")
elif a>b:
print("Right")
else:
print("Balanced")
*Java :*
java15
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
long a,b;
Scanner sc =new Scanner(System.in);
a=sc.nextLong();
b=sc.nextLong();
if(a>b){
System.out.println("Right");
}
else if(a<b){
System.out.println("Left");
}
else{
System.out.println("Balanced");
}
}
}