-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8af93d0
commit ddd2b3e
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.gitproject; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Scanner; | ||
import java.util.Stack; | ||
|
||
public class Beecrowd1063_uri { | ||
public static void main(String[] args) | ||
{ | ||
Scanner s = new Scanner(System.in); | ||
int n = s.nextInt(); | ||
while(n != 0) | ||
{ | ||
Stack<Character> train= new Stack<>(); | ||
|
||
ArrayList<Character> in = new ArrayList<>(); | ||
ArrayList<Character> res = new ArrayList<>(); | ||
for(int i=0;i<n;i++) | ||
{ | ||
in.add(s.next().charAt(0)); | ||
} | ||
for(int i=0;i<n;i++) | ||
{ | ||
res.add(s.next().charAt(0)); | ||
} | ||
int t = 0; | ||
for(int i=0;i<n;i++) | ||
{ | ||
|
||
train.push(in.get(i)); | ||
System.out.print("I"); | ||
|
||
while (train.size() > 0 && res.get(t) == train.peek()) //coz we want combo same as res | ||
{ | ||
train.pop(); | ||
System.out.print("R"); | ||
t++; | ||
} | ||
} | ||
|
||
if (train.size() != 0) | ||
System.out.println(" Impossible"); | ||
|
||
n = s.nextInt(); | ||
} | ||
} | ||
} | ||
/* | ||
Input goes as: | ||
--bottom to top in stack/LIFO -- | ||
a | ||
d | ||
t | ||
e | ||
Output comes out as: | ||
--top to bottom-- | ||
d | ||
a | ||
t | ||
e | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.gitproject; | ||
|
||
import java.util.Scanner; | ||
|
||
public class Beecrowd3084_uri { | ||
public static void main(String[] args) { | ||
Scanner s = new Scanner(System.in); | ||
|
||
|
||
while (s.hasNext()) { | ||
String input = s.nextLine(); | ||
String[] list = input.split(" "); | ||
|
||
int x = Integer.parseInt(list[0]); | ||
int y = Integer.parseInt(list[1]); | ||
|
||
if (x== 0 && y==0) { | ||
System.out.println("00:00"); | ||
} | ||
else { | ||
x /= 30; | ||
y /= 6; | ||
if (x < 10 && y >= 10) { | ||
System.out.printf("0%d:%d\n", x, y); | ||
} | ||
else if (y < 10 && x >= 10) { | ||
System.out.printf("%d:0%d\n", x, y); | ||
} | ||
else if (y < 10) { | ||
System.out.printf("0%d:0%d\n", x, y); | ||
} | ||
else | ||
System.out.printf("%d:%d\n", x,y); | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
|
||
|
||
|