{"id":491,"date":"2019-03-02T17:03:57","date_gmt":"2019-03-02T08:03:57","guid":{"rendered":"http:\/\/www.mukgee.com\/?p=491"},"modified":"2020-12-27T01:24:17","modified_gmt":"2020-12-26T16:24:17","slug":"%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98%ec%82%ac%eb%8b%a4%eb%a6%ac%ed%83%80%ea%b8%b01","status":"publish","type":"post","link":"http:\/\/mukgee.com\/?p=491","title":{"rendered":"[\uc54c\uace0\ub9ac\uc998]\uc0ac\ub2e4\ub9ac\ud0c0\uae301"},"content":{"rendered":"<p>\uc0ac\ub2e4\ub9ac \ud0c0\uae30\ub97c \ud55c\ub2e4.<\/p>\n<p>\uc785\ub825\uac12\uc740 100&#215;100\uc758 \ub9e4\ud2b8\ub9ad\uc2a4\ud615\ud0dc\uc774\uace0<\/p>\n<p>\uc0ac\ub2e4\ub9ac\uac00 \uc5f0\uacb0\ub41c \uacf3\uc740 1\ub85c \uc5f0\uacb0\ub418\uc9c0 \uc54a\uc740 \uacf3\uc740 0\uc73c\ub85c \ud45c\ud604\ub41c\ub2e4<\/p>\n<p>\ucd5c\uc885 \ubaa9\uc801\uc9c0\ub294 2\ub85c \ud45c\ud604\ub420\ub54c \uac01 \ubaa9\uc801\uc9c0\ub85c \ub3c4\ucc29\ud560 \uc218 \uc788\ub294 \uc2dc\uc791\uc810 \uc758 index\ub97c \uad6c\ud558\ub294\ubb38\uc81c<\/p>\n<pre class=\"lang:java decode:true \">import java.util.Scanner;\npublic class Solution{\n    \n    public static void main(String[] agrs){\n        int testCase = 10;\n    \tString[][] matrix = new String[100][100];\n        Solution sol = new Solution();\n        Scanner sc = new Scanner(System.in);\n        \n        for(int inx = 0 ; inx &lt; testCase ; inx++){\n            String testNo =sc.nextLine();\n            boolean isStraight = true;\n            for(int inj = 0 ; inj &lt; 100 ; inj++){\n                String inputs =sc.nextLine();\n                matrix[inj]= inputs.split(\" \");\n            }\n            int startPoint = sol.getDestination(matrix[matrix.length-1]);\n            int result = sol.moveNextStep(matrix , matrix.length-1 , startPoint , \"UP\");\n            System.out.println(\"#\"+testNo + \" \" + String.valueOf(result));\n        }\n    }\n    \n    public int getDestination(String[] lastRow){\n        for(int inx = 0 ; inx &lt; lastRow.length ; inx++){\n            if(\"2\".equals(lastRow[inx])){\n                return inx;\n            }\n        }\n        return -1;\n    }\n    \n    public int moveNextStep(String[][] matrix, int row, int column , String direction){\n        if(row == 0 ) return column;\n        if(!\"RIGHT\".equals(direction) &amp;&amp; \n           column-1 &gt; -1 &amp;&amp; \"1\".equals(matrix[row][column-1])) return moveNextStep( matrix, row, column-1, \"LEFT\");\n        else if(!\"LEFT\".equals(direction) &amp;&amp; \n            column+1 &lt; 100 &amp;&amp; \"1\".equals(matrix[row][column+1])) return moveNextStep( matrix, row, column+1, \"RIGHT\");\n\t    else if(\"1\".equals(matrix[row-1][column])) return moveNextStep( matrix, row-1, column, \"UP\");\n        \n        return 0;\n    }\n}<\/pre>\n<p>\ucd9c\ucc98 :\u00a0https:\/\/www.swexpertacademy.com\/main\/code\/problem\/problemDetail.do?contestProbId=AV14ABYKADACFAYh&amp;categoryId=AV14ABYKADACFAYh&amp;categoryType=CODE<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc0ac\ub2e4\ub9ac \ud0c0\uae30\ub97c \ud55c\ub2e4. \uc785\ub825\uac12\uc740 100&#215;100\uc758 \ub9e4\ud2b8\ub9ad\uc2a4\ud615\ud0dc\uc774\uace0 \uc0ac\ub2e4\ub9ac\uac00 \uc5f0\uacb0\ub41c \uacf3\uc740 1\ub85c \uc5f0\uacb0\ub418\uc9c0 \uc54a\uc740 \uacf3\uc740 0\uc73c\ub85c \ud45c\ud604\ub41c\ub2e4 \ucd5c\uc885 \ubaa9\uc801\uc9c0\ub294 2\ub85c \ud45c\ud604\ub420\ub54c \uac01 \ubaa9\uc801\uc9c0\ub85c \ub3c4\ucc29\ud560 \uc218 \uc788\ub294 \uc2dc\uc791\uc810&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3],"tags":[48,53],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts\/491"}],"collection":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=491"}],"version-history":[{"count":1,"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts\/491\/revisions"}],"predecessor-version":[{"id":611,"href":"http:\/\/mukgee.com\/index.php?rest_route=\/wp\/v2\/posts\/491\/revisions\/611"}],"wp:attachment":[{"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=491"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mukgee.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}