The other day, your friend was sharing their screen over Zoom. They pulled up their terminal and typed in cowsay "hello world" and an ascii art cow appeared that said "hello world"! Seeing this, you were inspired to make a slightly different version of this with your favorite animal, an elephant. In your version, you have input with the words that the elephant is saying as well as the ascii art for the elephant. Your job is to output this information.
Tips on using input:
- If you're using Java or C++, be sure to clear your buffer after reading in an int!
The first line of input will contain a string $$$S$$$ containing the text that the elephant will be saying.
The second line of input will contain an integer $$$N$$$, the number of lines of ascii art to follow.
The following $$$N$$$ lines of input will each contain a string containing a line of ascii art. These lines will be in the order such that they form an elephant.
$$$1 \leq N \leq 50$$$
Output the text that the elephant is saying followed by a new line and then each line of the ascii elephant in the order that it was given.
Hello World
15
__
'. \
'- \
/ /_ .---.
/ | \\,.\/--.// )
| \// )/ /
\ ' ^ ^ / )____.----.. 6
'.____. .___/ \._)
.\/. )
'\ /
_/ \/ ). ) (
/# .! | /\ /
\ C// # /'-----''/ # /
. 'C/ | | | | | ,
\), .. .'OOO-'. ..'OOO'OOO-'. ..\(,
Hello World
__
'. \
'- \
/ /_ .---.
/ | \\,.\/--.// )
| \// )/ /
\ ' ^ ^ / )____.----.. 6
'.____. .___/ \._)
.\/. )
'\ /
_/ \/ ). ) (
/# .! | /\ /
\ C// # /'-----''/ # /
. 'C/ | | | | | ,
\), .. .'OOO-'. ..'OOO'OOO-'. ..\(,
Hope you're having an elephantastic day! 4 _____ ( . . ) / |_| \, |_| |_|
Hope you're having an elephantastic day! _____ ( . . ) / |_| \, |_| |_|
Deja has been battling with a frustrating race condition on her cooperative multithreading assignment in her operating systems class. She decides to go to the TA's zoom office hours the day before the assignment is due and finds a lot of her peers in the same predicament! The TA is overwhelmed and informs the $$$n$$$ students in the call to remember what order that they joined the call in so that the TA can answer their questions in that order. Deja was so preoccupied with her perplexing bug that she forgot where exactly in the queue of students that she was. She does know, however, that there were at least $$$x$$$ people ahead of her and no more than $$$y$$$ students behind her. Help Deja figure out how many different positions in the queue that she could be at.
There is only one line of input which contains three space-separated integers, $$$n$$$, $$$x$$$, and $$$y$$$ ($$$1 \leq x, y \lt n \leq 1,000,000$$$)
Output a single integer representing the number of different positions in the queue Deja could be at. It is guaranteed that there will be at least one valid position for Deja to be at.
4 2 1
2
6 1 3
4
In the first sample, Deja could be at positions $$$3$$$ or $$$4$$$ (if the positions are one-indexed) and this would ensure that she has at least two people in front of her and at most one person after her.
Similar logic means that for the second sample, she could be at positions $$$3$$$, $$$4$$$, $$$5$$$, and $$$6$$$ (again one-indexing the positions).
It's the first couple weeks of school and one of your professors, Professor Moody, has left you some feedback on your first assignment. Unfortunately, he tends to ramble and isn't the most coherent (some of his feedback seems like he just copied and pasted Dr. Seuss poems?!). Given a list of positive and negative words, you want to create a program that determines if his text is positive or negative by counting positive and negative words.
If there are more positive words than negative then his feedback is positive. If there are more negative words than positive then his feedback is negative. Finally, if there are an equal number of positive and negative words, then his feedback is perfectly neutral. Some words in the feedback are not positive or negative and do not need to be counted.
The first line of input will contain an integer $$$P$$$, the number of positive words to follow.
The following $$$P$$$ lines of input will each contain a word determined to be positive.
The next line of input will contain an integer $$$N$$$, the number of negative words to follow.
The following $$$N$$$ lines of input will each contain a word determined to be negative.
The next line of input will contain an integer $$$W$$$, the number of words in Professor Moody's feedback.
The next $$$W$$$ lines will each contain a string that represents the next word in Professor Moody's feedback.
$$$1 \leq P \leq 100$$$
$$$1 \leq N \leq 100$$$
$$$1 \leq W \leq 1000$$$
Print either Positive, Negative, or Neutral based on the tone of Professor Moody's feedback as defined above.
5 great happy congratulations smart care 5 worry dont bad worst terrible 17 congratulations this was the worst paper ever bad job oh the places you will go terrible work
Negative
4 great happy good terrific 5 worry not bad worst terrible 18 this was a great paper one fish two fish red fish blue fish terrific work elephants not bad
Neutral
Emily is currently in a Zoom call with some friends. Currently, she is viewing the call in a way such that everyone's videos are on and everyone is in a line.
Ansh, another person in the call, is curious if people have their video flipped. He decides that on the count of three, everyone in the call will look right. However, because some people's cameras are flipped, this may result in them looking left in everyone else's perspective!
Emily however, is more curious in how many clumps would form, where a clump is a contiguous set of people who are all looking the same direction. After everyone turned their heads, she took a screenshot of everyone's faces in a line. Given the directions that everyone is facing, help Emily determine how many clumps are in the photo!
The first line contains $$$N\;(1 \le N \le 10^5)$$$, the number of people in the call.
The next $$$N$$$ lines each contain a single character L or R. An L in the $$$i^{th}$$$ line represents that the $$$i^{th}$$$ person was looking left in the photo, while an R in the $$$i^{th}$$$ line represents that the $$$i^{th}$$$ person was looking right in the photo.
A single integer $$$C$$$, the number of clumps that have formed.
4 R L L R
3
Eric Yuan, founder and CEO of Zoom, has decided that the Zoom company headquarters in San Jose, CA is just not in an ideal location. Rent prices are rising by the day, but more importantly, Eric wants the headquarters building to have some kind of special connection to the Zoom user base, in a way that San Jose is lacking.
Eric has decided that the new headquarters building should be placed at the site of the average location of all Zoom users. That way the company can be symbolically placed at the center of its users' lives. Of course, if he truly wanted to follow through with this idea, the building would need to be built somewhere beneath the Earth's crust. But to make his vision feasible in reality, Eric has decided to simplify his model of the world to just consider 2D locations on a flat map.
Given a list of $$$N$$$ cities, each with a location ($$$x_i, y_i$$$) on the map and a population of Zoom users $$$p_i$$$ concentrated in that city, help Eric figure out where to build the new Zoom headquarters!
The first line of input contains the integer $$$N$$$ ($$$1\leq N \lt 1000$$$). The next $$$N$$$ lines each consist of three integers: $$$x_i$$$, $$$y_i$$$ where ($$$-1000\leq x_i, y_i\leq 1000$$$), and $$$p_i$$$ where ($$$1\leq p_i \lt 1000$$$), denoting the coordinate location and user population (in thousands) of the $$$i^{th}$$$ city.
Output the average location of all Zoom users, $$$x_a$$$ and $$$y_a$$$, within a $$$.0001$$$ margin of error. Assume that all Zoom users live exactly at the ($$$x,y$$$) location of their home city.
3 -10 6 4 1 -9 3 8 8 3
-1.3 2.1
Elijah and Fiona are trying to improve their fitness this quarantine season and have decided to set up daily zoom workout sessions in order to motivate each other. Their workout routine has gone great for the past couple weeks with the exception of the pushup sets. Elijah hates pushups so he devises this game to try to offload as much of the pushups as he can onto Fiona. They usually do $$$n$$$ different rounds of pushups in a given workout session. For each round, they decide to play the following game: the number of pushups in the $$$i$$$th round is $$$a_i$$$ and the players take turns replacing the number with any of its divisors other than itself. The person that replaces the number with a $$$1$$$ loses. Fiona agrees to play the game with Elijah on the condition that if she wins the $$$i$$$th round, Elijah must do double the amount of pushups ($$$2 \cdot a_i$$$) allotted for that round and if he wins, he doesn't have to do any pushup that round. Given that both players play the game optimally, calculate the number of pushups that Elijah will have to do after all the rounds.
Elijah and Fiona have become fitness buffs so the number of pushups per round can be quite large, be sure to use the appropriately sized type (like longs in Java and C++).
The first line contains the number of pushup amounts $$$n$$$ $$$(1 \leq n \leq 100)$$$.
Then, $$$n$$$ lines will follow, the $$$i$$$th line will contain a single integer $$$a_i$$$ $$$(2 \leq a_i \leq 10^{11})$$$.
Output the number of pushups that Elijah will have to do after playing all the games.
1 6
0
2 30 2
4
For the first sample, Elijah can replace the $$$6$$$ with $$$3$$$, and then Fiona is forced to replace $$$3$$$ with a $$$1$$$ so Elijah will win and will not have to do any push-ups.
Terrence, like the rest of us, occasionally finds himself stuck in a Zoom call that is not particularly exciting, perhaps even boring. At times like these, he likes to send Direct Messages to his friends on the call to liven up the mood. Rather than sending something normal like links to memes, Terrence prefers to send what he calls a Character Quilt.
A Character Quilt is a rectangular grid of transformed Character Tiles, and a Character Tile is simply a square grid of characters. In order to construct a Character Quilt, Terrence starts by defining $$$N$$$ aesthetically pleasing Character Tiles, where each Character Tile consists of a grid of characters with dimensions $$$S \times S$$$. After that, Terrence defines the overall Character Quilt which is a $$$W\times H$$$ grid of Character Tiles. For each tile slot in the quilt, he specifies the index $$$i$$$ ($$$0\leq i \lt N$$$) of the tile that should fill that slot.
To make things more interesting, Terrence also specifies a transformation indicator $$$t$$$ for each tile slot in the quilt, indicating what kind of transformation should be applied to the source Character Tile. When $$$t=0$$$, no transformation is applied. When $$$t=1$$$, the Character Tile should be rotated 90 degrees clockwise. When $$$t=2$$$, the Character Tile is rotated 180 degrees. When $$$t=3$$$, the Character Tile should be rotated 270 degrees clockwise. When $$$t=4$$$, the Character Tile is flipped across the vertical axis (side-to-side), and lastly, when $$$t=5$$$, the Character Tile is flipped across the horizontal axis.
For example, with a $$$2\times 2$$$ tile $$$\matrix{ ab \cr cd \cr }$$$, below are the transformation results for each value of $$$t$$$.
$$$\begin{array}{|c|c|c|c|c|c|c|} \hline t: & 0 & 1 & 2 & 3 & 4 & 5 \cr \hline Tile: & ab & ca & dc & bd & ba & cd \cr & cd & db & ba & ac & dc & ab \cr \hline \end{array}$$$
Help Terrence automatically generate his Character Quilts so that he can rapidly spam his friends!
The first line of input contains two integers: $$$N$$$ and $$$S$$$ ($$$1 \leq N, S \leq 15$$$). Then $$$N$$$ Character Tiles follow, each consisting of $$$S$$$ lines with $$$S$$$ characters.
The next line of input contains two integers: $$$W$$$ and $$$H$$$ ($$$1\leq W,H \leq 100$$$). $$$H$$$ lines follow. Each of these lines contain $$$W$$$ tile specifications where a tile specification is of the form $$$i:t$$$. The first number $$$i$$$ is the index of a Character Tile from the inputted list ($$$0$$$ represents the first tile and $$$N-1$$$ represents the last), and $$$t$$$ specifies the type of transformation to apply to that tile in the final quilt.
Print the final Character Quilt, with all of the transformed Character Tiles filled into the right places.
2 3 <<> ^<^ <>> >*= *+* +=> 5 3 0:0 1:0 0:0 1:4 0:0 1:0 1:1 1:2 1:3 1:0 0:5 1:0 0:5 1:4 0:5
<<>>*=<<>=*><<> ^<^*+*^<^*+*^<^ <>>+=><>>>=+<>> >*=+*>>=+=*>>*= *+*=+**+**+=*+* +=>>*==*>>*++=> <>>>*=<>>=*><>> ^<^*+*^<^*+*^<^ <<>+=><<>>=+<<>