Advertisement
EntropyStarRover

Challenge the wedding

Mar 2nd, 2019
154
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function challenge(input){
  2.     let ms=Number(input.shift());
  3.     let fs=Number(input.shift());
  4.     let tables=Number(input.shift());
  5.     let encounters=0
  6.     let toPrint="";
  7.  
  8.    
  9.         for (let m=1;m<=ms; m++){
  10.             for (let f=1; f<=fs; f++){
  11.                 toPrint+="("+ m+" <-> "+ f+") ";
  12.            
  13.                 encounters++;
  14.                 if (encounters>=tables){
  15.                     break;
  16.                 }
  17.                
  18.             }
  19.            
  20.     } console.log(toPrint);
  21.  
  22. }
Advertisement
RAW Paste Data Copied
Advertisement