File tree Expand file tree Collapse file tree 6 files changed +98
-8
lines changed
_02_Java_Stdin_and_Stdout_I
_04_Java_Stdin_and_Stdout_II
_05_Java_Output_Formatting Expand file tree Collapse file tree 6 files changed +98
-8
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package memos .world ._01_Welcome_To_Java ;
2
+
3
+ // https://www.hackerrank.com/challenges/welcome-to-java/problem
4
+ public class Solution {
5
+ public static void main (String [] args ) {
6
+ System .out .println ("Hello, World." );
7
+ System .out .println ("Hello, Java." );
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ package memos .world ._02_Java_Stdin_and_Stdout_I ;
2
+
3
+ import java .util .*;
4
+
5
+ // https://www.hackerrank.com/challenges/java-stdin-and-stdout-1/problem
6
+ public class Solution {
7
+ public static void main (String [] args ) {
8
+ Scanner scanner = new Scanner (System .in );
9
+ int a = scanner .nextInt ();
10
+ int b = scanner .nextInt ();
11
+ int c = scanner .nextInt ();
12
+
13
+ System .out .println (a );
14
+ System .out .println (b );
15
+ System .out .println (c );
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ package memos .world ._03_Java_If_Else ;
2
+
3
+ import java .io .*;
4
+ import java .math .*;
5
+ import java .security .*;
6
+ import java .text .*;
7
+ import java .util .*;
8
+ import java .util .concurrent .*;
9
+ import java .util .regex .*;
10
+
11
+ // https://www.hackerrank.com/challenges/java-if-else/problem
12
+ public class Solution {
13
+ private static final Scanner scanner = new Scanner (System .in );
14
+
15
+ public static void main (String [] args ) {
16
+ int N = scanner .nextInt ();
17
+ scanner .skip ("(\r \n |[\n \r \u2028 \u2029 \u0085 ])?" );
18
+
19
+ scanner .close ();
20
+
21
+ if (N % 2 == 1 ) {
22
+ System .out .println ("Weird" );
23
+ } else {
24
+ if (N >= 2 && N <= 5 ) {
25
+ System .out .println ("Not Weird" );
26
+ } else if (N >= 6 && N <= 20 ) {
27
+ System .out .println ("Weird" );
28
+ } else if (N > 20 ) {
29
+ System .out .println ("Not Weird" );
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+
36
+
Original file line number Diff line number Diff line change
1
+ package memos .world ._04_Java_Stdin_and_Stdout_II ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ // https://www.hackerrank.com/challenges/java-stdin-stdout/problem
6
+ public class Solution {
7
+ public static void main (String [] args ) {
8
+ Scanner scanner = new Scanner (System .in );
9
+ int i = scanner .nextInt ();
10
+ double d = scanner .nextDouble ();
11
+ scanner .nextLine ();
12
+ String s = scanner .nextLine ();
13
+
14
+ System .out .println ("String: " + s );
15
+ System .out .println ("Double: " + d );
16
+ System .out .println ("Int: " + i );
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ package memos .world ._05_Java_Output_Formatting ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ // https://www.hackerrank.com/challenges/java-output-formatting/problem
6
+ public class Solution {
7
+
8
+ public static void main (String [] args ) {
9
+ Scanner scanner = new Scanner (System .in );
10
+ System .out .println ("================================" );
11
+ for (int i = 0 ; i < 3 ; i ++) {
12
+ String s1 = scanner .next ();
13
+ int x = scanner .nextInt ();
14
+ System .out .printf ("%-15s%03d\n " , s1 , x );
15
+ }
16
+ System .out .println ("================================" );
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments