You are on page 1of 3

University of the Philippines Los Banos 

College of Arts and Sciences 


Institute of Computer Science 
CMSC 128 - Introduction to Software Engineering 
Second Semester, AY 2017-2018 
Problem Solving (Required): Where is the love? 
By RNC Recario 
 
Rationale: 
As  a  future  developer  or  analyst,  one  of  the  most  critical  skills  for  you  to  have  is  your  problem-solving 
and  analysis  skills.  This  particular  assignment  is  designed  to  somehow  challenge  your  problem-solving 
and analysis skills as indicated in the problem below. 
 
Objectives: 
At the end of the activity, the student is expected to: 
● Solve a given problem using the available technical details provided. 
● Analyze the problem and provide possible solutions and problems. 
● Provide a practical, realistic, optimal and logical solution that is well-defined. 
 
Groupings:​ This is an i​ ndividual activity. 
 
Maximum Deadline: 
March 9, 2018, 7:00:00 PM Philippine Standard Time (PST) 
 
Requirements: 
1. Code must be written in C 
 
Problem: 
“Where  is  the  love?”  is  a  song  popularized  by  The  Black  Eyed  Peas.  The  original  upbeat  and  positively 
sounding  version  was  released  in  2003  while  a  dark,  haunting  version  was  released  in  2016.  In  both 
versions,  the  members  of  The  Black  Eyed  Peas  (most  of  whom  also  wrote  the  song  along  with  Justin 
Timberlake  with  an  uncredited  vocals  in  the  original  version)  ask  where  is  the  love  in  various  life 
scenarios and relationships. 
 
We  can  help  The  Black  Eyed  Peas  by  finding  the  word  love  in an NxN matrix of letters much like a word 
search  puzzle.  Only  lowercase  letters  in  the  puzzle  are  observed.  The  word  love  can  be  searched 
horizontally  and  vertically  only.  The  word  love  must  be  spelled  out  in  order  and those spelled in reverse 
(horizontally and vertically) are not counted. The letters must be all present in sequential order. 
 
 
 
 
 

Assign 002 (Required): Where is the love? | Programming Challenge | RNC Recario​ ​Page 1 
Input: 
Two  inputs  are  provided:  an input N (0 < N <= 10000) giving the size of the board (NxN) and a filename F 
containing the NxN matrix of characters. Assume that F is a text file and that the length of the filename F 
is  no  more  than  30  characters  (inclusive  of  “.txt”).  Also  assume  that  the  C  file  and  the text file are in the 
same directory. 
 
 
Output: 
Indicate  whether  the  word  “love”  (only  in  lowercase)  can  be  found  in  the  file  in  both  horizontal  and 
vertical  fashion.  If  “love”  is  not  found,  write  “no love”. If board size is not within the acceptable range or 
file name does not exist, write “error”. 
 
 
Example: 
Input  File contains  Output 

0 sample.txt  /*empty*/  error 

0 sample.txt  a  error 

10000000 sample.txt  dgdgggdgdgdgdgdgdgdgdga...  error 

5 sample.txt  /*file does not exist*/  error 

4 love.txt  love 2 
olov
vlov
evol

5 you.txt  iLove no love 


youcu
tieba
byily
qaswr
 
 
C Filename: <section>-<lastname>.c​ (all in lowercase; e.g., a
​ 0l-recario.c​) 
 
 
Submission link:​ ​https://goo.gl/QxJEck
Answer the form and submit the C file as is (do not zip or compress the file!) 
 
 
 
 

Assign 002 (Required): Where is the love? | Programming Challenge | RNC Recario​ ​Page 2 
 
Scoring: 
TEN-ta-Cruel 
● Be  part  of  the  first  ten  students  who  finishes  the  program  correctly  before  12:00  PM  of 
March 3 (Saturday) and earn a maximum of 15 points out of 10 points. 
 
First Runner 
● If  you  are  not  part  of  the first ten, submit the correct program until March 3 (Saturday) 5PM 
and earn a maximum of 10 points out of 10 points. 
 
ParaYouCanChill 
● Submit  the  correct  program  March  3 (Saturday) 5:01:01 PM until March 5 (Monday) 5PM and 
earn a maximum of 8 points out of 10 points. 
 
AverageJuan 
● Submit  the  correct  program  March  5  (Monday)  5:01:01  PM  until  March  7  (Wednesday)  5PM 
and earn a maximum of 7 points out of 10 points. 
 
BeatingTheRedLight 
● Submit  the  correct  program  March  7  (Wednesday)  5:00:01  PM  until  March  9  (Friday)  7PM 
and earn a maximum of 6 points out of 10 points. 
 
 
Notes: 
● Plagiarism will not be tolerated and will be dealt with. 
● Do not share your code or solution with others. 
● Document your work. 
● Students  with  questionable  codes  will  not  receive  the  maximum  points  and  will be asked by the 
lecturer to explain their output. 
● Multiple submission is not allowed. The first submission will be recognized. 
● Assume  for  the  inputs  to  be  correct  if  not  stated  in  the  problem  to  be  considered  (e.g,  N  is  not 
negative or N is a number or the file contains the same numbers of characters per line). 
● You  are  graded  because  of  compliance  with  test  cases,  good  coding  practice  and  soundness  of 
solution (spot checks with your solutions will be done). 
 

Assign 002 (Required): Where is the love? | Programming Challenge | RNC Recario​ ​Page 3 

You might also like