Advertise with Googlier.com Latest DMOJ Commentshttp://139.162.15.171:81/The latest comments on the Jetic's Online Judge websiteenWed, 03 Nov 2021 01:14:53 +0000jetic -> Shakespeare 1http://139.162.15.171:81/oj/problem/csci120p005#comment-28<p>Here's some python instructions: To test your code, you can read the hamlet text from the file instead of <code>stdin</code>:</p> <pre><code>raw_hamlet = [] with open("shakespeare-hamlet.txt", "r") as input_file: for line in input_file: raw_hamlet.append(line)</code></pre> <p>and when submitting to the OJ, replace the code above with reading from <code>stdin</code>:</p> <pre><code>raw_hamlet = [input() + "\n"] while raw_hamlet[-1] != "--------\n": raw_hamlet.append(input() + "\n")</code></pre> <p>Careful, when reading from <code>stdin</code>, the newline symbols will not appear in your <code>str</code>, this is different from using file operations. Please make sure you process the raw input for special symbols as well.</p> Wed, 03 Nov 2021 01:14:53 +0000http://139.162.15.171:81/oj/problem/csci120p005#comment-28jetic -> String practice 2http://139.162.15.171:81/oj/problem/csci125p020#comment-26<p>Hint:</p> <p>In Python, to keep reading from <code>stdin</code> until <code>EOF</code>, you can do this:</p> <pre><code>while True: try : line = input() ... except EOFError: break</code></pre> Wed, 22 Sep 2021 17:39:56 +0000http://139.162.15.171:81/oj/problem/csci125p020#comment-26jetic -> String practice 1http://139.162.15.171:81/oj/problem/csci125p019#comment-25<p>In Python, if you have 2 string <code>str1</code> and <code>str2</code>, and you want to know if <code>str2</code> is a substring of <code>str1</code>, you can simply use the expression</p> <pre><code>if str2 in str1: print("Is substring") else: print("Not substring")</code></pre> <p>The expression <code>str2 in str1</code> will return to you a <code>bool</code> value of either <code>True</code> or <code>False</code></p> Wed, 22 Sep 2021 17:33:21 +0000http://139.162.15.171:81/oj/problem/csci125p019#comment-25jetic -> Function practice 8 (Village of the Sorcerer 4)http://139.162.15.171:81/oj/problem/csci125p017#comment-9<p>More sample I/O <a href="https://jetic.org/wp-content/uploads/2020/07/p017_more_sample.zip" rel="nofollow">https://jetic.org/wp-content/uploads/2020/07/p017_more_sample.zip</a></p> Tue, 21 Jul 2020 02:31:26 +0000http://139.162.15.171:81/oj/problem/csci125p017#comment-9jetic -> String Splittinghttp://139.162.15.171:81/oj/problem/csci125lab3p2#comment-8<p>Hint: here's the code for the main programme used in evaluation:</p> <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include "lab3p2.h" using namespace std; string ans[100]; int main() { string instr; while (getline(cin, instr)) { for (int i=0; i&lt;100; i++) ans[i].clear(); split(instr, ans); int i=0; while (i &lt; 100) { if (ans[i].length() != 0) cout &lt;&lt; ans[i] &lt;&lt; ' '; i++; } cout &lt;&lt; endl; instr = ""; } return 0; }</code></pre> Sun, 19 Jul 2020 16:17:09 +0000http://139.162.15.171:81/oj/problem/csci125lab3p2#comment-8jetic -> String practice 2http://139.162.15.171:81/oj/problem/csci125p020#comment-7<p>Hint:</p> <p>In C++, to keep reading in a complete line until EOF, you can do this:</p> <pre><code>string line; while (getline(cin, line)) { // do your stuff }</code></pre> Tue, 07 Jul 2020 01:29:51 +0000http://139.162.15.171:81/oj/problem/csci125p020#comment-7jetic -> Function practice 9 (Village of the Sorcerer 5)http://139.162.15.171:81/oj/problem/csci125p018#comment-6<p>All in all, P018 is a lot more difficult for me since the test case designs are much more complicated. The actual solution is not that hard, and if you are me you are looking at around 30 more lines of code.</p> Wed, 24 Jun 2020 05:17:08 +0000http://139.162.15.171:81/oj/problem/csci125p018#comment-6jetic -> Function practice 9 (Village of the Sorcerer 5)http://139.162.15.171:81/oj/problem/csci125p018#comment-5<p>As the promised hint, this is what I used for the reference programme.</p> <pre><code>#include &lt;iostream&gt; using namespace std; int maps[100][100][100]; // maps[level][x_coordinate][y_coordinate] int start[100][2]; // the starting position on every map int houses[100][100]; // the level each house on every map points to. // houses[level][houseNumber] // alternatively, use houses[100][100][100] if it makes your life easier int k, n, m; int currentMap; // it is important to know which level/map you are currently on void drawTree(char a[][100], int x, int y); void drawHouse(char a[][100], int x, int y); void printMap(int map[][100], int x, int y); int checkMove(int map[][100], int x, int y); void movePlayer(int map[][100], int&amp; x, int&amp; y, int dir);</code></pre> Wed, 24 Jun 2020 05:12:59 +0000http://139.162.15.171:81/oj/problem/csci125p018#comment-5jetic -> For practice 2http://139.162.15.171:81/oj/problem/csci125p005#comment-2<p>Consider the following bare-bone code:</p> <pre><code>#include &lt;cstdio&gt; int main() { int n; scanf("%d", &amp;n); int a = 1; int b = 1; int tmp; printf("%d\n", a); printf("%d\n", b); for (...) printf("%d\n", a+b); return 0; }</code></pre> <p>Can you figure out a way to ONLY modify the for loop condition to solve this task? Please try.</p> Thu, 28 May 2020 18:51:08 +0000http://139.162.15.171:81/oj/problem/csci125p005#comment-2