[go: up one dir, main page]

Skip to content

mwu412/DSC_HW2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

<title>Problem 11859</title>
<!-- bootstrap, bootwatch CSS -->

<link rel="stylesheet" href="/static/bootswatch/cerulean/bootstrap.min.css">

<!-- Magnific Popup core CSS -->
<link rel="stylesheet" href=/static/magnific-popup/dist/magnific-popup.css>
<link rel="stylesheet" href=/static/css/index.css media="screen">
<link rel="stylesheet" href=/static/css/mfp-fade.css media="screen">
<script src=/static/jquery/dist/jquery.min.js></script>
Toggle navigation NTHU Online Judge
        <li>
          <a href=/users/notification/ id="notification">
            
            <img src=/static/images/bell_blue.png  id="notification_img"
                 title="You have 30 unread notifications."/>
            <div id="notification_circle" class="center">
              <b id="number">
                
                  30
                
              </b>
            </div>
            
          </a>
        </li>
        
        
        <li class="nav-text-auth">
          <a href="/users/profile/DSC103033210">
            <i id="name-text">DSC103033210</i>
          </a>
        </li>
        <li class="nav-text-auth"><a href="/users/logout/">Logout</a></li>
        
      </ul>
    </div>
  </div>
</nav>

<!-- wrap all page elements to div -->
<div class="wrap-body container-fluid">

11859 - infix maze   
  </h2>
</div>

Status  |  Limits
    <a class="btn btn-primary" href="/users/submit/11859">Submit</a>
  
</div>
× Close

Limits

          <tr>
            <th>Case 1</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 2</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 3</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 4</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 5</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 6</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 7</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 8</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 9</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
          <tr>
            <th>Case 10</th>
            <td>1 sec</td>
            <td>32 MB</td>
          </tr>
          
      </tbody>
    </table>
  </div>
</div>

Description

Determine whether a matrix contains at least a legal infix expression which need to be from the top-left corner to the bottom-right corner. If yes, convert it based on the postfix notation.

There are some rules to be followed. 

  • Each cell can be reached by four directions(up, down, right, left).
  • Matrices are consisted of 1~9, +,-,*,/, (, )
  • Each cell can be visited at most one time.
  • The priority directions are: down>right>left>up.
  • No negative number. EX: - 5 + 3 is illegal.
 

Input

First line is total number of matrices.

Second and third line are matrix width nad height.

Width and height <100.

Following lines are matrix.

Output

Repeat all inputs.
For matrix, there is a white space after every elements.

If there is a legal infix expression from the top-left corner to the bottom-right corner,  output
Yes
infix expression ( there is a white space after every elements.)
postfix expression ( there is a white space after every elements.)

If No, output
No

Sample Input  Download

<textarea id='11859_sampleIn' class='panel-body sampleIO' readonly>1 3 3 1 5 4 + - * + 6 8 </textarea>

Sample Output  Download

<textarea id='11859_sampleOut' class='panel-body sampleIO' readonly>1 3 3 1 5 4 + - * + 6 8 Yes 15 - 68 15 68 - </textarea>

Tags

</div>

  <form id='addTag'>
    <input type='hidden' name='csrfmiddlewaretoken' value='XmgNZ3ux73FnysHzFjIPxn3THuMhyXYs' />
    <div class='input-group'>
      <input class="form-control autocomplete vTextField autocomplete-light-text-widget autocomplete vTextField autocomplete-light-text-widget" data-autocomplete-choice-selector="[data-value]" data-autocomplete-minimum-characters="1" data-autocomplete-url="/autocomplete/TagAutocomplete/" data-widget-bootstrap="text" id="id_tag_name" maxlength="20" name="tag_name" placeholder="" type="text" />
      <span class="input-group-btn">
    <button id='addTagButton' class="btn btn-default" type="button">
      Add Tag
    </button>
      </span>
    </div>
  </form>



Discuss




<script> var pid = 11859; </script> <script src="/static/problem/js/problem.js"></script>
</div>

<!-- footer -->
<footer>
  <div class="navbar navbar-inverse navbar-fixed-bottom sticky-footer container-fluid">
    <div class="navbar-collapse collapse">
      <p class="navbar-text col-lg-4">Contact us: nthucsoj@gmail.com</p>
      <p class="navbar-text col-lg-6">© NTHU Online Judge 2015, Templates are from Bootswatch Project</p>
      <p id="time" class="navbar-text">2018/05/02 16:25:57</p>
    </div>
  </div>
</footer>

<!-- JS -->
<script src=/static/bootstrap/dist/js/bootstrap.min.js></script>
<script src=/static/js/function.js></script>
<script src=/static/magnific-popup/dist/jquery.magnific-popup.min.js></script>
<script type="text/javascript"> jQuery(function($) { function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } function csrfSafeMethod(method) { // these HTTP methods do not require CSRF protection return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); } function sameOrigin(url) { // test that a given url is a same-origin URL // url could be relative or scheme relative or absolute var host = document.location.host; // host + port var protocol = document.location.protocol; var sr_origin = '//' + host; var origin = protocol + sr_origin; // Allow absolute or scheme relative URLs to same origin return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || // or any other URL that isn't scheme relative or absolute i.e relative. !(/^(\/\/|http:|https:).*/.test(url)); } $.ajaxSetup({ beforeSend: function(xhr, settings) { if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) { // Send the token to same-origin, relative URLs only. // Send the token only if the method warrants CSRF protection // Using the CSRFToken value acquired earlier xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); } } }); }); </script> <script type="text/javascript" src="/static/autocomplete_light/django_admin.js"></script> <script type="text/javascript" src="/static/autocomplete_light/autocomplete.js"></script> <script type="text/javascript" src="/static/autocomplete_light/widget.js"></script> <script type="text/javascript" src="/static/autocomplete_light/addanother.js"></script> <script type="text/javascript" src="/static/autocomplete_light/text_widget.js"></script> <script type="text/javascript" src="/static/autocomplete_light/remote.js"></script>
<script src=/static/js/popup-setting.js></script>
<script src=/static/js/base.js></script>
<script src=/static/js/clock.js></script>
Time Memory

Releases

No releases published

Packages

No packages published

Languages