-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
its all coming together...! (created front end)
- Loading branch information
1 parent
4e4aae8
commit b7338e5
Showing
15 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
problem_id: PRB1 | ||
problem_name: The Homework Prank | ||
time_limit: 1 | ||
memory_limit: 64 | ||
scoring_method: average | ||
checker: diff | ||
max_score: 100 | ||
|
||
subtasks: | ||
- name: main | ||
score: 100 | ||
num_samples: 1 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
A, B = map(int, input().split()) | ||
print(A+B+2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
One day, Blake comes to you and begs you to help him with his homework! He asks you to write a program that can sum two numbers together, and print out the result. | ||
|
||
However, as you begin writing this program, you ask yourself: *Why is Blake asking me to do this? Can't he just use a calculator?* | ||
|
||
After thinking for a while, you realize that Blake is just SUPER lazy, which also explains why he's doing the homework on the day that it's due. So, you decide to teach Blake a lesson for relying on you to bail him out. You'll write the program for Blake... but you're going to intentionally give him the wrong answers. | ||
|
||
Specifically, you'll write a program that **sums two numbers together**. However, **the result you print will always be 2 greater than the actual sum**. For example, if the two numbers your program receives are $4$ and $3$, your program would output $9$ instead of $7$. With any luck, Blake won't check your program's answers, and once he gets all the answers wrong, he'll learn not to bug you for EVERY. SINGLE. ASSIGNMENT. | ||
|
||
Blake is waiting for you... pull this thing off! :) | ||
(Note: Never do this to someone in real life.) | ||
|
||
#### INPUT FORMAT | ||
|
||
Your program will receive two integers $A$ and $B$, separated by a single space. These are the integers that Blake wants to know the sum of. | ||
|
||
#### OUTPUT FORMAT | ||
|
||
Your program should output one integer. This integer should be exactly 2 more than the sum of the numbers that Blake gave you. | ||
(In mathy terms, you should output the value of $A + B + 2$.) | ||
|
||
#### CONSTRAINTS | ||
|
||
The numbers that Blake gives your program will both be in the range $1...10{,}000$. | ||
(In mathy terms, $1 \leq A, B \leq 10{,}000$.) | ||
|
||
#### SAMPLE INPUT | ||
```text | ||
9 10 | ||
``` | ||
|
||
#### SAMPLE OUTPUT | ||
```text | ||
21 | ||
``` | ||
|
||
#### EXPLANATION | ||
|
||
$9 + 10 = 19$. Since your program should output $2$ more than the actual sum of the numbers, your program should output $21$. | ||
|
||
Not sure which programming language to use? If you have prior experience with a programming language, that's the one you should use! Otherwise, Java would probably be your best bet, since the school's programming courses (Intro to Java / APCS) use Java. | ||
|
||
If you need help, try getting a hint by clicking the hint button below! There's no penalty for using hints, but try your best to solve the problem without hints first. | ||
|
||
#### HINTS | ||
|
||
1. Here are some helpful links to learn how to parse input. | ||
[Java Input Parsing](https://www.programiz.com/java-programming/scanner) | ||
[C++ Input Parsing](https://www.learncpp.com/cpp-tutorial/introduction-to-iostream-cout-cin-and-endl/) | ||
[Python 3 Input Parsing](https://pynative.com/python-input-function-get-user-input/) | ||
Remember not to print any prompts like "Enter a number" or "The answer is" in your program. The grader will get confused by these prompts, and your solution may be marked as wrong! If you don't have much experience with the programming language you chose, it might help to learn the basics of that programming language before trying these challenge problems (variables, if/else statements, for loops, input/output). | ||
|
||
2. Here is some sample source code for all 3 languages. However, all the programs below print out the *actual* sum of the two numbers, instead of printing out the number that is $2$ greater than the sum. Do you know how to fix it? | ||
|
||
Java (You'll need to change the class name to match your file name) | ||
```java | ||
import java.util.Scanner; | ||
|
||
public class PRB1 { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int A = sc.nextInt(); | ||
int B = sc.nextInt(); | ||
int fakeSum = A + B; | ||
System.out.println(fakeSum); | ||
} | ||
} | ||
``` | ||
C++ | ||
```cpp | ||
#include <iostream> | ||
|
||
int main() { | ||
int A, B; | ||
std::cin >> A >> B; | ||
int fakeSum = A + B; | ||
std::cout << fakeSum << std::endl; | ||
} | ||
``` | ||
Python 3 | ||
```python | ||
A, B = map(int, input().split()) | ||
fake_sum = A + B | ||
print(fake_sum) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
192 719 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
913 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10000 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20002 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
I like to echo. Do you like to echo? | ||
(Oh by the way, I also like doubling numbers. Big numbers. HUGE numbers.) | ||
|
||
Input: Something to echo, consisting of only alphanumeric characters, possibly separated by a single space (no newlines). | ||
|
||
Output: ??? | ||
|
||
Scoring (out of 1000): | ||
Grading method is average_stop (partials allowed, but stops on the first failed test for each subtask). | ||
250 points for subtask 1, 250 points for subtask 2, 500 points for subtask 3. | ||
Bonus: | ||
50 points for subtask 4, 100 points for subtask 5. | ||
|
||
Note: A real problem probably shouldn't have this many test cases (it'll slow down the system). This is just to show off the capabilities of the judge system. :D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
This problem serves as a way for you to test the submission system. It also shows off sample cases, along with a special mode where subtask numbers are not shown! | ||
Each test case gives you a single integer as input (from 1 to 10). Just echo the integer back to get AC. | ||
Have fun experimenting! | ||
|
||
Sample input: 1 | ||
Sample output: 1 | ||
|
||
Scoring (out of 100): | ||
Grading method is average (partials allowed). There is 1 sample case. If this sample doesn't pass, none of the other cases will be evaluated. | ||
1 bonus point is available as well! ;) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
function showSubmitStatus() { | ||
// Display status at top of page | ||
let statusClone = document.getElementById("submit-status-display").content.cloneNode(true); | ||
document.getElementById("result-panel").innerHTML = ""; | ||
document.getElementById("result-panel").appendChild(statusClone); | ||
} | ||
|
||
function sendData() { | ||
// Disable submit button while uploading data | ||
document.getElementById("submit-button").disabled = true; | ||
document.getElementById("submit-button").innerText = "Submitting..."; | ||
|
||
// Get form data / use an AJAX request to call the submission API | ||
let formData = new FormData(form); | ||
let xhr = new XMLHttpRequest(); | ||
xhr.onload = function() { | ||
let resp = JSON.parse(xhr.response); | ||
if (xhr.status == 200) { | ||
// Add job_id to URL parameters | ||
let refresh = window.location.protocol + "//" + window.location.host + window.location.pathname + `?job_id=${resp["job_id"]}`; | ||
window.history.pushState({ path: refresh }, '', refresh); | ||
showSubmitStatus(); | ||
// Smooth scroll to top of page | ||
window.scrollTo({ top: 0, behavior: "smooth" }); | ||
} else if (xhr.status == 400) { | ||
// Display error in a very unfriendly way | ||
document.getElementById("response-text").innerHTML = "Submission failed: " + resp["error"]; | ||
} | ||
// Reenable submit button | ||
document.getElementById("submit-button").disabled = false; | ||
document.getElementById("submit-button").innerText = "Submit!"; | ||
}; | ||
xhr.open("POST", "/api/submit", true); | ||
xhr.send(formData); | ||
}; | ||
|
||
// Override form's default submit behavior | ||
const form = document.getElementById("test-form"); | ||
form.addEventListener("submit", function (event) { | ||
event.preventDefault(); | ||
sendData(); | ||
}); | ||
|
||
window.onload = function() { | ||
if ((new URLSearchParams(window.location.search)).has('job_id')) { | ||
showSubmitStatus(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<p style="text-align: center;"><a href="/problem_list">Back to problem list</a></p> | ||
|
||
<div id="result-panel"></div> | ||
|
||
<h1>{{ problem.name }}</h1> | ||
{% if problem.time_limit == 1 %} | ||
<h4>Time limit: {{ problem.time_limit }} second</h4> | ||
{% else %} | ||
<h4>Time limit: {{ problem.time_limit }} seconds</h4> | ||
{% endif %} | ||
<h4>Memory limit: {{ problem.memory_limit }} MB</h4> | ||
<h4>Max score: {{ problem.max_score }} points</h4> | ||
|
||
<hr> | ||
{{ problem.statement | safe }} | ||
<hr> | ||
|
||
<form id="test-form" autocomplete="on"> | ||
<h2>Submission Form</h2> | ||
<br> | ||
<input id="problem_id" name="problem_id" type="hidden" value="{{ problem.id }}"> | ||
<label for="username">Username:</label> | ||
<input id="username" name="username" type="text"> | ||
<br> <br> | ||
<label for="type">Language:</label> | ||
<select id="type" name="type"> | ||
<option value="java">Java</option> | ||
<option value="cpp">C++</option> | ||
<option value="python">Python 3</option> | ||
</select> | ||
<br> <br> | ||
<label for="code">Code to submit:</label> | ||
<input id="code" name="code" type="file"> | ||
<br> <br> | ||
<button type="submit" id="submit-button" autocomplete="off">Submit!</button> | ||
</form> | ||
|
||
<br> | ||
<div id="response-text"></div> | ||
|
||
<script src="/static/submit.js"></script> | ||
|
||
<template id="submit-status-display"> | ||
<div id="submission-result-box"> | ||
<div class="progress-box"></div> | ||
<div class="submission-status"> | ||
<p class="status-text">Waiting...</p> | ||
<div class="loader"></div> | ||
</div> | ||
<div class="test-results-box"></div> | ||
</div> | ||
|
||
<p id="raw-text"></p> | ||
|
||
<template id="test-result"> | ||
<a href="#" class="tooltip-no-underline"> | ||
<div class="test-result"> | ||
<div class="test-verdict"></div> | ||
<div class="test-number"></div> | ||
<div class="test-info"> | ||
<div class="test-memory"></div> | ||
<div class="test-time"></div> | ||
</div> | ||
</div> | ||
</a> | ||
</template> | ||
<script src="/static/status.js"></script> | ||
</template> | ||
{% endblock %} |