In: Economics
Swayamvar
Problem Description
A ceremony where a Bride chooses her Groom from an array of eligible bachelors is called Swayamvar. But this is a Swayamvar with difference. An array of Bride-to-be will choose from an array of Groom-to-be.
The arrangement at this Swayamvar is as follows
· Brides-to-be are organized such that the most eligible bachelorette will get first chance to choose her Groom. Only then, the next most eligible bachelorette will get a chance to choose her Groom
· If the initial most eligible bachelorette does not get a Groom of her choice, none of the Brides-to-be have any chance at all to get married. So unless a senior bachelorette is out of the “queue”, the junior bachelorette does not get a chance to select her Groom-to-be
· Inital state of Grooms-to-be is such that most eligible bachelor is at the head of the “queue”. The next most eligible bachelor is next in the queue. So on and so forth.
· Now everything hinges on the choice of the bachelorette. The most eligible bachelorette will now meet the most eligible bachelor.
· If bachelorette selects the bachelor, both, the bachelorette and the bachelor are now Bride and Groom respectively and will no longer be a part of the Swayamvar activity. Now, the next most eligible bachelorette will get a chance to choose her Groom. Her first option is the next most eligible bachelor (relative to initial state)
· If the most eligible bachelorette passes the most eligible bachelor, the most eligible bachelor now moves to the end of the queue. The next most eligible bachelor is now considered by the most eligible bachelorette. Selection or Passing over will have the same consequences as explained earlier.
· If most eligible bachelorette reaches the end of bachelor queue, then the Swayamvar is over. Nobody can get married.
· Given a mix of Selection or Passing over, different pairs will get formed.
The selection criteria is as follows
1. Each person either drinks rum or mojito. Bride will choose groom only if he drinks the same drink as her.
Note : There are equal number of brides and grooms for the swayamvar.
Tyrion as the hand of the king wants to know how many pairs will be left unmatched. Can you help Tyrion?
Constraints
1<= N <= 10^4
Input Format
First line contains one integer N, which denotes the number of brides and grooms taking part in the swayamvar. Second line contains a string in lowercase, of length N containing initial state of brides-to-be. Third line contains a string in lowercase, of length N containing initial state of grooms-to-be. Each string contains only lowercase 'r' and 'm' stating person at that index drinks "rum"(for 'r') or mojito(for 'm').
Output
Output a single integer denoting the number of pairs left unmatched.
Timeout
1
Explanation
Example 1
Input
4
rrmm mrmr
Output
0
Explanation
The bride at first place will only marry groom who drinks rum. So the groom at first place will join the end of the queue. Updated groom's queue is "rmrm".
Now the bride at first place will marry the groom at first place. Updated bride's queue is "rmm" and groom's queue is "mrm".
The process continues and at last there are no pairs left. So answer is 0.
Example 2
Input
4 rmrm mmmr
Output
2
Explanation
Following the above process 2 pairs will be left unmatched. Remember that bride will not move until she gets a groom of her choice.
In: Statistics and Probability
USING MATLAB
Where indicated in the script below, write a function, called
myflip, which accepts one vector v (either a column or a row) and
outputs the same vector v of the same dimensions, but with the
values in reverse order (use MATLAB function flip()). In other
words, v will be overwritten by its flipped version. In your
function, you may only use length() and floor(). You only need one
loop.
%this code tests the function, myflip, which you will write below
v1 = 100*rand(1);
v1 = myflip(v1)
n = randi([2 100], 1, 1);
v2 = 100*rand(1,2*n);
v2 = myflip(v2)
n = randi([2 100], 1, 1);
v3 = 100*rand(2*n+1,1);
v3 = myflip(v3)
In: Computer Science
South Africa is proposing a project that will increase sugar cane production in the country. South Africa is a net exporter of sugar cane and exports to the UK. Assume the following: • The CIF at Liverpool, UK is £360 per ton • Freight, insurance and unloading from Cape Town, a South African port to Liverpool is £15 per ton • Local port charges at South Africa is 150 Rand per ton • Transport and marketing costs from warehouse to the port in Cape Town is 120 Rand per ton • Storage, transport and marketing cost from point of production to warehouse is 50 rand per ton • No export taxes • The Exchange rate is £1= 12 rands Where the rand is the South African currency and £ is the British Pound Sterling Answer the following questions
a) Estimate the FOB price at the Cape Town port in South Africa in £
b) Estimate the FOB price in Rands
c) Estimate export parity price at a warehouse in South Africa
d) Estimate the export parity price at farm gate in South Africa.
In: Accounting
For this project, you will create a program in C that will test the user’s proficiency at solving different types of math problems. The program will be menu driven. The user will select either addition, subtraction, multiplication or division problems. The program will then display a problem, prompt the user for an answer and then check the answer displaying an appropriate message to the user whether their answer was correct or incorrect. The user will be allowed 3 tries at each problem. The program will also keep statistics on how many problems were answered correctly.
This week you will add functions to allow the user to select problems of varying degrees of difficulty and also keep statistics on number of correct answers vs. total number of problems attempted.
So now let’s add the code for the remaining functions:
We’ll start by inserting code to ask the user if they want to see problems that are easy, medium or difficult. We’ll do this by prompting them to enter ‘e’ for easy, ‘m’ for medium or ‘d’ for difficult and we’ll do this right after they have selected the type of problems they want. We will also add a validation loop that will check to see if they entered a correct response (e,m, or d).
Easy – problems using numbers 0 thru 10
Medium – problems 11 thru 100
Difficult – problems 100 – 1000
Here’s some code to get you started on the “difficulty level.”
if( difficultyLevel == 'E')
{
num1=rand()%10+1;
num2=rand()%10+1;
}
else
if (difficultyLevel == 'M')
{num1=rand()%100+1;
num2=rand()%100+1;
}
else
{ num1=rand()%1000+1;
num2=rand()%1000+1;}
Use an “if” statement to check the difficulty and generate the random numbers.
Statistics:
Create two variables ttlProblems and correctAnswers. Every time the user answers a problem add 1 to ttlProblems and every correct answer add 1 to correctAnswers. We’ll display the total number of problems and correct answers as well as the percent correct after the user has selected the exit option on the main menu.
Then, alter the code to allow for floating point numbers. This requires formatting the output.
In: Computer Science
what does force regulation in a given muscle depend on (other than Cross-Bride formation)
In: Anatomy and Physiology
SITUATION:
Arwa and Rand are both businesswomen in Auh. Arwa is a textiles (cloth) trader and imports cloth from India and sells it to readymade garment manufacturers in the UAE. Rand owns a designer wear Kaftan making company in Auh. She buys cloth from Arwa at AED 50 per meter, uses 2 meters cloth for every Kaftan she makes [in her factory], and sells them at AED 1000 per Kaftan.
Jealous Arwa thinks: For every AED 100 that Rand pays me (per Kaftan) she makes 900. I am her only supplier, and have 2 choices: (i) I must increase my price to AED 300 per meter, or (ii) open a factory and start making / selling Kaftans myself, and make AED 1000 per Kaftan. Also, this way, I will be my own supplier! However, getting a license to enter Rand’s type of business is extremely difficult. Too many government regulations, and very few licenses.
Crooked Rand thinks: (i) What if Arwa becomes greedy and increases her selling price suddenly? There are no other local suppliers. Since I have plenty of cash in the bank, why don’t I set up my own textile trading company, import my own cloth, and stop depending on Arwa? Getting a trade license to import textiles is very easy, it takes just 1 week. Anyone can get into Arwa’s low-profit business.
QUESTION:
In strategic management terminology, what are the points, or thoughts that are passing through Arwa’s and Rand’s minds? Provide your answer below their names:
i) Terminologies for Arwa’s thoughts/points:
ii) Terminologies for Rand’s thoughts/points
In: Finance
Inside “Lab1”folder, create a project named “Lab1Ex1”. Use this
project to write and run a C++ program that produces: Define a
constant value called MAX_SIZE with value of 10. Define an array
of integers called Class_Marks with MAX_SIZE which contains
students Mark. Define a function called “Fill_Array” that takes an
array, and array size as parameters. The function fills the odd
index of the array randomly in the range of [50- 100] and fills the
even index of the array using input from user. The valid input
values are between 50-100.
Hint: To get random number you can use rand() function: min +
rand()%(max-min+1) Fill the array by calling Fill_Array
function
In: Computer Science
How would I add a quickSort function to the below C++ code to sort the randomly generated numbers?
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int i;
int array[10];
int odd;
int Max;
int counter = 0;
int main()
{
cout << "The 10 random elements are: ";
cout << endl;
srand ( time(0) );
for (int j = 0; j < 99; j++)
{
i = rand() % 100;
if (i != i - 1)
array[j] = i;
else
{
i = rand() % 100;
array[j] = i;
}
}
for (int k = 0; k < 10 ; k++)
{
cout << array[k] << "\n";
}
cout << endl;
return 0;
}In: Computer Science
You are comparing the regression output across two publicly-traded companies. Both regressions were run using monthly data for 5 years and against the S&P500 with the returns on each company’s stock as the independent variable.
|
Nero Cannery |
Rand Foods |
|
| Intercept | 0.15% | 0.45% |
| R-squared | 20% | 35% |
| Slope | 1.20 | 1.10 |
1.If the implied equity risk premium with a constant dividend growth rate and based on a broad U.S. stock market index is equal to 8% and the risk-free rate is 2%, what is the required return of an investor in Nero Cannery? Rand Foods?
2. You just found out that even though Rand Foods is incorporated in the U.S. it gets 100% of its revenues from Mexico. Is it appropriate to use an implied equity risk premium based on a U.S. stock market index for calculating an investor’s required return in Rand? Why or why not? If the Mexican government bond rating is A3 (not default-free), how will you approach the estimation of the ERP, i.e. what method will you use and what information do you need?
3. Is the regression above an “excess returns” regression or a “raw returns” regression? Explain.
(4) Interpret the R2 and intercept for Rand Foods.
In: Finance