commit
e040b2fc2f
@ -0,0 +1,33 @@ |
|||||||
|
HELP.md |
||||||
|
target/ |
||||||
|
!.mvn/wrapper/maven-wrapper.jar |
||||||
|
!**/src/main/**/target/ |
||||||
|
!**/src/test/**/target/ |
||||||
|
|
||||||
|
### STS ### |
||||||
|
.apt_generated |
||||||
|
.classpath |
||||||
|
.factorypath |
||||||
|
.project |
||||||
|
.settings |
||||||
|
.springBeans |
||||||
|
.sts4-cache |
||||||
|
|
||||||
|
### IntelliJ IDEA ### |
||||||
|
.idea |
||||||
|
*.iws |
||||||
|
*.iml |
||||||
|
*.ipr |
||||||
|
|
||||||
|
### NetBeans ### |
||||||
|
/nbproject/private/ |
||||||
|
/nbbuild/ |
||||||
|
/dist/ |
||||||
|
/nbdist/ |
||||||
|
/.nb-gradle/ |
||||||
|
build/ |
||||||
|
!**/src/main/**/build/ |
||||||
|
!**/src/test/**/build/ |
||||||
|
|
||||||
|
### VS Code ### |
||||||
|
.vscode/ |
@ -0,0 +1,51 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<groupId>net.lensfrex</groupId> |
||||||
|
<artifactId>wust-oj-collection</artifactId> |
||||||
|
<version>1.0-SNAPSHOT</version> |
||||||
|
|
||||||
|
<properties> |
||||||
|
<maven.compiler.source>8</maven.compiler.source> |
||||||
|
<maven.compiler.target>8</maven.compiler.target> |
||||||
|
</properties> |
||||||
|
|
||||||
|
<dependencies> |
||||||
|
|
||||||
|
<!-- <dependency>--> |
||||||
|
<!-- <groupId>com.fasterxml.jackson.core</groupId>--> |
||||||
|
<!-- <artifactId>jackson-core</artifactId>--> |
||||||
|
<!-- <version>2.13.3</version>--> |
||||||
|
<!-- </dependency>--> |
||||||
|
|
||||||
|
<!-- <dependency>--> |
||||||
|
<!-- <groupId>com.fasterxml.jackson.core</groupId>--> |
||||||
|
<!-- <artifactId>jackson-annotations</artifactId>--> |
||||||
|
<!-- <version>2.13.3</version>--> |
||||||
|
<!-- </dependency>--> |
||||||
|
|
||||||
|
<!-- <dependency>--> |
||||||
|
<!-- <groupId>com.fasterxml.jackson.core</groupId>--> |
||||||
|
<!-- <artifactId>jackson-databind</artifactId>--> |
||||||
|
<!-- <version>2.13.3</version>--> |
||||||
|
<!-- </dependency>--> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.google.code.gson</groupId> |
||||||
|
<artifactId>gson</artifactId> |
||||||
|
<version>2.9.0</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||||
|
<artifactId>httpclient</artifactId> |
||||||
|
<version>4.5.13</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
</dependencies> |
||||||
|
|
||||||
|
</project> |
@ -0,0 +1,93 @@ |
|||||||
|
package net.lensfrex.oj.collector; |
||||||
|
|
||||||
|
import com.google.gson.Gson; |
||||||
|
import com.google.gson.JsonArray; |
||||||
|
import com.google.gson.JsonParser; |
||||||
|
import net.lensfrex.oj.collector.data.Result; |
||||||
|
import net.lensfrex.oj.collector.utils.NetworkUtil; |
||||||
|
import org.apache.http.client.utils.URIBuilder; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.net.URISyntaxException; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Arrays; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public class Collector { |
||||||
|
|
||||||
|
private static final String API_BASE = "https://oj.wust-acm.top/api/problem"; |
||||||
|
|
||||||
|
private static final int PAGE_LIMIT = 100; |
||||||
|
|
||||||
|
private String generatePageRequestUrl(String baseUrl, int offset, int limit, int page) throws URISyntaxException { |
||||||
|
URIBuilder uriBuilder = new URIBuilder(baseUrl); |
||||||
|
uriBuilder.addParameter("paging", "true"); |
||||||
|
uriBuilder.addParameter("offset", String.valueOf(offset)); |
||||||
|
uriBuilder.addParameter("limit", String.valueOf(limit)); |
||||||
|
uriBuilder.addParameter("page", String.valueOf(page)); |
||||||
|
|
||||||
|
return uriBuilder.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
private HashMap<String, String> getHeaders() { |
||||||
|
HashMap<String, String> headers = new HashMap<>(); |
||||||
|
|
||||||
|
headers.put("User-Agent", "lensfrex/0.0.1 CanYouSeeMe/0.0.2 IJustLearning/0.0.3"); |
||||||
|
headers.put("Host", "oj.wust-acm.top"); |
||||||
|
headers.put("Accept-Encoding", "gzip, deflate, br"); |
||||||
|
|
||||||
|
return headers; |
||||||
|
} |
||||||
|
|
||||||
|
private Result[] getResults(String url, Map<String, String> headers) throws IOException { |
||||||
|
String json = NetworkUtil.get(url, headers); |
||||||
|
|
||||||
|
JsonArray resultJsonArray = JsonParser.parseString(json).getAsJsonObject() |
||||||
|
.getAsJsonObject("data") |
||||||
|
.getAsJsonArray("results"); |
||||||
|
|
||||||
|
return new Gson().fromJson(resultJsonArray, Result[].class); |
||||||
|
} |
||||||
|
|
||||||
|
public ArrayList<Result> collectAllResults() { |
||||||
|
ArrayList<Result> results = new ArrayList<>(); |
||||||
|
try { |
||||||
|
String url = generatePageRequestUrl(API_BASE, 0, 1, 1); |
||||||
|
HashMap<String, String> headers = getHeaders(); |
||||||
|
|
||||||
|
String json = NetworkUtil.get(url, headers); |
||||||
|
|
||||||
|
int totalResult = JsonParser.parseString(json).getAsJsonObject() |
||||||
|
.getAsJsonObject("data") |
||||||
|
.getAsJsonPrimitive("total").getAsInt(); |
||||||
|
|
||||||
|
int page = (totalResult / PAGE_LIMIT) + (totalResult % PAGE_LIMIT == 0 ? 0 : 1); |
||||||
|
|
||||||
|
|
||||||
|
System.out.println("Total results: " + totalResult); |
||||||
|
System.out.println("Page Limit: " + PAGE_LIMIT); |
||||||
|
System.out.println("Total pages: " + page); |
||||||
|
|
||||||
|
for (int i = 1; i <= page; i++) { |
||||||
|
int offset = (i - 1) * PAGE_LIMIT; |
||||||
|
System.out.println("\n------------------------------------------------------"); |
||||||
|
System.out.println("Getting page " + i); |
||||||
|
System.out.println("Offset " + offset); |
||||||
|
|
||||||
|
url = generatePageRequestUrl(API_BASE, offset, PAGE_LIMIT, i); |
||||||
|
System.out.println("Request URL: " + url); |
||||||
|
|
||||||
|
Result[] results1 = getResults(url, headers); |
||||||
|
|
||||||
|
results.addAll(Arrays.asList(results1)); |
||||||
|
|
||||||
|
System.out.println("Successful get " + results1.length + " result(s)"); |
||||||
|
} |
||||||
|
} catch (URISyntaxException | IOException e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
|
||||||
|
return results; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package net.lensfrex.oj.collector; |
||||||
|
|
||||||
|
import net.lensfrex.oj.collector.data.Result; |
||||||
|
import net.lensfrex.oj.collector.utils.IOUtil; |
||||||
|
import net.lensfrex.oj.collector.utils.ParamFiller; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.net.URISyntaxException; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
|
||||||
|
public class Main { |
||||||
|
|
||||||
|
private static final String MAIN_TEMPLATE = IOUtil.inputStreamToString(Record.class.getResourceAsStream("/template.txt"), StandardCharsets.UTF_8); |
||||||
|
private static final String EXAMPLE_TEMPLATE = IOUtil.inputStreamToString(Record.class.getResourceAsStream("/exampleTemplates.txt"), StandardCharsets.UTF_8); |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
try { |
||||||
|
new Main().run(); |
||||||
|
} catch (URISyntaxException | IOException e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static final String location = "D:\\ojs"; |
||||||
|
|
||||||
|
private void run() throws URISyntaxException, IOException { |
||||||
|
Record record = new Record(); |
||||||
|
ArrayList<Result> results = new Collector().collectAllResults(); |
||||||
|
|
||||||
|
String context = ""; |
||||||
|
for (Result result : results) { |
||||||
|
context = record.fillText(result); |
||||||
|
|
||||||
|
record.writeToFile(location, result.getId(), result.getTitle(), context); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,77 @@ |
|||||||
|
package net.lensfrex.oj.collector; |
||||||
|
|
||||||
|
import net.lensfrex.oj.collector.data.Result; |
||||||
|
import net.lensfrex.oj.collector.data.Sample; |
||||||
|
import net.lensfrex.oj.collector.utils.IOUtil; |
||||||
|
import net.lensfrex.oj.collector.utils.ParamFiller; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.ResourceBundle; |
||||||
|
import java.util.regex.Pattern; |
||||||
|
|
||||||
|
public class Record { |
||||||
|
private static final String MAIN_TEMPLATE = IOUtil.inputStreamToString(Record.class.getResourceAsStream("/template.txt"), StandardCharsets.UTF_8); |
||||||
|
private static final String EXAMPLE_TEMPLATE = IOUtil.inputStreamToString(Record.class.getResourceAsStream("/exampleTemplates.txt"), StandardCharsets.UTF_8); |
||||||
|
|
||||||
|
public String fillText(Result results) { |
||||||
|
HashMap<String, String> params = new HashMap<>(); |
||||||
|
params.put("title", results.getTitle()); |
||||||
|
params.put("description", results.getDescription()); |
||||||
|
params.put("inputDescription", results.getInputDescription()); |
||||||
|
params.put("outputDescription", results.getOutputDescription()); |
||||||
|
params.put("timeLimit", results.getTimeLimit().toString()); |
||||||
|
params.put("memoryLimit", results.getMemoryLimit().toString()); |
||||||
|
params.put("level", results.getDifficulty()); |
||||||
|
params.put("id", results.getId()); |
||||||
|
params.put("tags", results.getTags().toString()); |
||||||
|
params.put("hint", results.getHint()); |
||||||
|
|
||||||
|
StringBuffer exampleStringBuffer = new StringBuffer(); |
||||||
|
List<Sample> samples = results.getSamples(); |
||||||
|
int sampleSize = samples.size(); |
||||||
|
for (int i = 0; i < sampleSize; i++) { |
||||||
|
exampleStringBuffer.append(fillExampleText(samples.get(i), i + 1)); |
||||||
|
} |
||||||
|
|
||||||
|
params.put("examples", exampleStringBuffer.toString()); |
||||||
|
|
||||||
|
return ParamFiller.fill(MAIN_TEMPLATE, params); |
||||||
|
} |
||||||
|
|
||||||
|
private String fillExampleText(Sample sample, int index) { |
||||||
|
HashMap<String, String> params = new HashMap<>(); |
||||||
|
if (index == 1) { |
||||||
|
params.put("index", ""); |
||||||
|
|
||||||
|
} else { |
||||||
|
params.put("index", String.valueOf(index)); |
||||||
|
} |
||||||
|
params.put("inputExamples", sample.getInput()); |
||||||
|
params.put("outputExamples", sample.getOutput()); |
||||||
|
|
||||||
|
return ParamFiller.fill(EXAMPLE_TEMPLATE, params); |
||||||
|
} |
||||||
|
|
||||||
|
private static final Pattern FilePattern = Pattern.compile("[\\\\/:*?\"<>|]"); |
||||||
|
|
||||||
|
public static String filenameFilter(String str) { |
||||||
|
return str == null ? null : FilePattern.matcher(str).replaceAll(""); |
||||||
|
} |
||||||
|
|
||||||
|
public void writeToFile(String location, String id, String title, String context) { |
||||||
|
id = filenameFilter(id); |
||||||
|
title = filenameFilter(title); |
||||||
|
|
||||||
|
File file = new File(String.format("%s/%s - %s.md", location, id, title)); |
||||||
|
System.out.println("Will write to: " + file.getPath()); |
||||||
|
try { |
||||||
|
IOUtil.writeFile(context.getBytes(StandardCharsets.UTF_8), file); |
||||||
|
} catch (Exception e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,154 @@ |
|||||||
|
|
||||||
|
package net.lensfrex.oj.collector.data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import javax.annotation.Generated; |
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose; |
||||||
|
import com.google.gson.annotations.SerializedName; |
||||||
|
|
||||||
|
@Generated("net.hexar.json2pojo") |
||||||
|
@SuppressWarnings("unused") |
||||||
|
public class Result { |
||||||
|
@SerializedName("_id") |
||||||
|
private String id; |
||||||
|
@Expose |
||||||
|
private String title; |
||||||
|
@Expose |
||||||
|
private Object contest; |
||||||
|
@Expose |
||||||
|
private String description; |
||||||
|
@SerializedName("input_description") |
||||||
|
private String inputDescription; |
||||||
|
@SerializedName("output_description") |
||||||
|
private String outputDescription; |
||||||
|
@Expose |
||||||
|
private String difficulty; |
||||||
|
@Expose |
||||||
|
private String hint; |
||||||
|
@SerializedName("memory_limit") |
||||||
|
private Long memoryLimit; |
||||||
|
@SerializedName("time_limit") |
||||||
|
private Long timeLimit; |
||||||
|
@Expose |
||||||
|
private List<Sample> samples; |
||||||
|
@Expose |
||||||
|
private List<String> tags; |
||||||
|
|
||||||
|
public String getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(String id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public String getTitle() { |
||||||
|
return title; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTitle(String title) { |
||||||
|
this.title = title; |
||||||
|
} |
||||||
|
|
||||||
|
public Object getContest() { |
||||||
|
return contest; |
||||||
|
} |
||||||
|
|
||||||
|
public void setContest(Object contest) { |
||||||
|
this.contest = contest; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDescription() { |
||||||
|
return description; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDescription(String description) { |
||||||
|
this.description = description; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDifficulty() { |
||||||
|
return difficulty; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDifficulty(String difficulty) { |
||||||
|
this.difficulty = difficulty; |
||||||
|
} |
||||||
|
|
||||||
|
public String getHint() { |
||||||
|
return hint; |
||||||
|
} |
||||||
|
|
||||||
|
public void setHint(String hint) { |
||||||
|
this.hint = hint; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getMemoryLimit() { |
||||||
|
return memoryLimit; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMemoryLimit(Long memoryLimit) { |
||||||
|
this.memoryLimit = memoryLimit; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getTimeLimit() { |
||||||
|
return timeLimit; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTimeLimit(Long timeLimit) { |
||||||
|
this.timeLimit = timeLimit; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInputDescription() { |
||||||
|
return inputDescription; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInputDescription(String inputDescription) { |
||||||
|
this.inputDescription = inputDescription; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutputDescription() { |
||||||
|
return outputDescription; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutputDescription(String outputDescription) { |
||||||
|
this.outputDescription = outputDescription; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Sample> getSamples() { |
||||||
|
return samples; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSamples(List<Sample> samples) { |
||||||
|
this.samples = samples; |
||||||
|
} |
||||||
|
|
||||||
|
public List<String> getTags() { |
||||||
|
return tags; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTags(List<String> tags) { |
||||||
|
this.tags = tags; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
final StringBuffer sb = new StringBuffer("Result{"); |
||||||
|
sb.append("id='").append(id).append('\''); |
||||||
|
sb.append(", title='").append(title).append('\''); |
||||||
|
sb.append(", contest=").append(contest); |
||||||
|
sb.append(", description='").append(description).append('\''); |
||||||
|
sb.append(", difficulty='").append(difficulty).append('\''); |
||||||
|
sb.append(", hint='").append(hint).append('\''); |
||||||
|
sb.append(", memoryLimit=").append(memoryLimit); |
||||||
|
sb.append(", timeLimit=").append(timeLimit); |
||||||
|
sb.append(", inputDescription='").append(inputDescription).append('\''); |
||||||
|
sb.append(", outputDescription='").append(outputDescription).append('\''); |
||||||
|
sb.append(", samples=").append(samples); |
||||||
|
sb.append(", tags=").append(tags); |
||||||
|
sb.append('}'); |
||||||
|
return sb.toString(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
|
||||||
|
package net.lensfrex.oj.collector.data; |
||||||
|
|
||||||
|
import javax.annotation.Generated; |
||||||
|
import com.google.gson.annotations.Expose; |
||||||
|
|
||||||
|
@Generated("net.hexar.json2pojo") |
||||||
|
@SuppressWarnings("unused") |
||||||
|
public class Sample { |
||||||
|
|
||||||
|
@Expose |
||||||
|
private String input; |
||||||
|
@Expose |
||||||
|
private String output; |
||||||
|
|
||||||
|
public String getInput() { |
||||||
|
return input; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInput(String input) { |
||||||
|
this.input = input; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutput() { |
||||||
|
return output; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutput(String output) { |
||||||
|
this.output = output; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
package net.lensfrex.oj.collector.utils; |
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream; |
||||||
|
import java.io.File; |
||||||
|
import java.io.FileOutputStream; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.nio.charset.Charset; |
||||||
|
|
||||||
|
public class IOUtil { |
||||||
|
public static String inputStreamToString(InputStream inputStream, Charset charSet) { |
||||||
|
byte[] bytes = readDataFromInputStream(inputStream); |
||||||
|
if (bytes != null) { |
||||||
|
return new String(bytes, charSet); |
||||||
|
} else { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static byte[] readDataFromInputStream(InputStream inputStream) { |
||||||
|
return readDataFromInputStream(inputStream, 5);// read every 5kb in default
|
||||||
|
} |
||||||
|
|
||||||
|
public static byte[] readDataFromInputStream(InputStream inputStream, int byteAllocation) { |
||||||
|
try { |
||||||
|
ByteArrayOutputStream byteArrayInputStream = new ByteArrayOutputStream(); |
||||||
|
byte[] bytes = new byte[1024 * byteAllocation]; |
||||||
|
|
||||||
|
for (int length; (length = inputStream.read(bytes)) != -1; ) { |
||||||
|
byteArrayInputStream.write(bytes, 0, length); |
||||||
|
} |
||||||
|
|
||||||
|
byteArrayInputStream.flush(); |
||||||
|
|
||||||
|
inputStream.close(); |
||||||
|
byteArrayInputStream.close(); |
||||||
|
|
||||||
|
return byteArrayInputStream.toByteArray(); |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static void writeFile(byte[] bytes, File file) throws Exception { |
||||||
|
FileOutputStream fileOutputStream = new FileOutputStream(file, true); |
||||||
|
fileOutputStream.write(bytes); |
||||||
|
fileOutputStream.close(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,88 @@ |
|||||||
|
package net.lensfrex.oj.collector.utils; |
||||||
|
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils; |
||||||
|
import org.apache.http.HttpEntity; |
||||||
|
import org.apache.http.client.ClientProtocolException; |
||||||
|
import org.apache.http.client.ResponseHandler; |
||||||
|
import org.apache.http.client.methods.HttpGet; |
||||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||||
|
import org.apache.http.impl.client.HttpClients; |
||||||
|
import org.apache.http.util.EntityUtils; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.net.InetAddress; |
||||||
|
import java.net.NetworkInterface; |
||||||
|
import java.net.URL; |
||||||
|
import java.net.URLConnection; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public class NetworkUtil { |
||||||
|
|
||||||
|
public static final String REQUEST_USERAGENT = "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36"; |
||||||
|
|
||||||
|
public static String get(String url, Map<String, String> headers) throws IOException { |
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
// HttpGet httpGet = new HttpGet("https://oj.wust-acm.top/api/problem?paging=true&offset=0&limit=10&page=1");
|
||||||
|
HttpGet httpGet = new HttpGet(url); |
||||||
|
|
||||||
|
// httpGet.setHeader("User-Agent", REQUEST_USERAGENT);
|
||||||
|
// httpGet.setHeader("Host", "oj.wust-acm.top");
|
||||||
|
// httpGet.setHeader("cookie", "_ga=GA1.2.829022655.1645538223; _gid=GA1.2.744163698.1657197518; csrftoken=6iT1oJ4KAqz8GOQidnnxk3nvNstEQSPhiEc8T9yKdEwN4nes7s09pdfZ9aw4Ao7k; sessionid=oh6wf39nblzc5h4aaifvzvievk386hsn");
|
||||||
|
// httpGet.setHeader("accept-encoding", "gzip, deflate, br");
|
||||||
|
|
||||||
|
for (String key : headers.keySet()) { |
||||||
|
httpGet.setHeader(key, headers.get(key)); |
||||||
|
} |
||||||
|
|
||||||
|
ResponseHandler<String> responseHandler = httpResponse -> { |
||||||
|
int status = httpResponse.getStatusLine().getStatusCode(); |
||||||
|
|
||||||
|
// System.out.println("code: " + status);
|
||||||
|
|
||||||
|
if (status >= 200 && status < 300) { |
||||||
|
HttpEntity entity = httpResponse.getEntity(); |
||||||
|
|
||||||
|
return entity != null ? EntityUtils.toString(entity) : null; |
||||||
|
} else { |
||||||
|
throw new ClientProtocolException("??"); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
String response = httpClient.execute(httpGet, responseHandler); |
||||||
|
httpClient.close(); |
||||||
|
|
||||||
|
return response; |
||||||
|
} |
||||||
|
|
||||||
|
public static byte[] download(String url) { |
||||||
|
try { |
||||||
|
URL requestUrl = new URL(url); |
||||||
|
URLConnection connection = requestUrl.openConnection(); |
||||||
|
|
||||||
|
connection.setRequestProperty("user-agent", REQUEST_USERAGENT); |
||||||
|
|
||||||
|
InputStream inputStream = connection.getInputStream(); |
||||||
|
|
||||||
|
return IOUtil.readDataFromInputStream(inputStream, 15); |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static String getMacMD5() { |
||||||
|
try { |
||||||
|
byte[] mac = NetworkInterface.getByInetAddress(InetAddress.getLocalHost()).getHardwareAddress(); |
||||||
|
StringBuffer sb = new StringBuffer(); |
||||||
|
|
||||||
|
for (byte b : mac) { |
||||||
|
String s = Integer.toHexString(b & 0xFF); |
||||||
|
sb.append(s.length() == 1 ? 0 + s : s); |
||||||
|
} |
||||||
|
return DigestUtils.md5Hex(sb.toString().toUpperCase()); |
||||||
|
} catch (Exception e) { |
||||||
|
return DigestUtils.md5Hex("(+_+)?"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
package net.lensfrex.oj.collector.utils; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.regex.Matcher; |
||||||
|
import java.util.regex.Pattern; |
||||||
|
|
||||||
|
public class ParamFiller { |
||||||
|
private static final String REG = "\\{\\{(.+?)\\}\\}"; |
||||||
|
private static final Pattern pattern = Pattern.compile(REG); |
||||||
|
|
||||||
|
public static String fill(String template, Map<String, String> data) { |
||||||
|
Matcher matcher = pattern.matcher(template); |
||||||
|
|
||||||
|
StringBuffer stringBuffer = new StringBuffer(); |
||||||
|
String key = "", value = ""; |
||||||
|
while (matcher.find()) { |
||||||
|
key = matcher.group(1); |
||||||
|
value = data.get(key); |
||||||
|
|
||||||
|
if (value != null) { |
||||||
|
// 直接正则替换遇到$会报错
|
||||||
|
value = value.replace("$", "$"); |
||||||
|
} |
||||||
|
matcher.appendReplacement(stringBuffer, value == null ? "" : value); |
||||||
|
} |
||||||
|
|
||||||
|
matcher.appendTail(stringBuffer); |
||||||
|
return stringBuffer.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
private static ArrayList<String> getParams(String template) { |
||||||
|
Matcher matcher = pattern.matcher(template); |
||||||
|
|
||||||
|
ArrayList<String> result = new ArrayList<>(); |
||||||
|
|
||||||
|
while (matcher.find()) { |
||||||
|
result.add(matcher.group(1)); |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package net.lensfrex.oj.collector.utils; |
||||||
|
|
||||||
|
import java.security.SecureRandom; |
||||||
|
|
||||||
|
public final class Random { |
||||||
|
|
||||||
|
private final java.util.Random random = new java.util.Random(); |
||||||
|
private final java.util.Random secRandom = new SecureRandom(); |
||||||
|
|
||||||
|
private boolean useSecureRandom = true; |
||||||
|
|
||||||
|
public void setUseSecureRandom(boolean useSecureRandom) { |
||||||
|
this.useSecureRandom = useSecureRandom; |
||||||
|
} |
||||||
|
|
||||||
|
public int getRandomNumber(int minNumber, int maxNumber) { |
||||||
|
if (useSecureRandom) { |
||||||
|
return minNumber + secRandom.nextInt(maxNumber - minNumber + 1); |
||||||
|
} else { |
||||||
|
return minNumber + random.nextInt(maxNumber - minNumber + 1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int getRandomNumber(int maxNumber) { |
||||||
|
if (useSecureRandom) { |
||||||
|
return secRandom.nextInt(maxNumber + 1); |
||||||
|
} else { |
||||||
|
return random.nextInt(maxNumber + 1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,598 @@ |
|||||||
|
{ |
||||||
|
"error": null, |
||||||
|
"data": { |
||||||
|
"results": [ |
||||||
|
{ |
||||||
|
"id": 2164, |
||||||
|
"tags": [ |
||||||
|
"ACM\u8bad\u7ec3" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "2022-041", |
||||||
|
"title": "\u670d\u52a1\u5668", |
||||||
|
"description": "<p>OJ\u670d\u52a1\u5668\u672c\u7740\u5148\u63d0\u4ea4\u5148\u670d\u52a1\u7684\u539f\u5219\u5bf9\u7528\u6237\u7684\u63d0\u4ea4\u8fdb\u884c\u5224\u9898\uff0c\u5373\u6bcf\u4e2a\u63d0\u4ea4\u5fc5\u987b\u5728\u524d\u4e00\u4e2a\u63d0\u4ea4\u5b8c\u6210\u540e\u624d\u80fd\u5f00\u59cb\u5224\u9898\u3002</p><p>\u73b0\u5728\u7ed9\u51fa\u4e86n\u4e2a\u63d0\u4ea4\u5224\u9898\u7684\u65f6\u95f4\u82b1\u8d39\uff0c\u95ee\u9898\u662f\u5728\u8bbe\u5b9a\u7684\u65f6\u95f4T\u5185\u6700\u591a\u53ef\u4ee5\u5b8c\u6210\u591a\u5c11\u4e2a\u63d0\u4ea4\u7684\u5224\u9898\uff1f<br /></p>", |
||||||
|
"input_description": "<p>\u6bcf\u7ec4\u6d4b\u8bd5\u6570\u636e\u5305\u542b2\u884c\uff0c\u7b2c1\u884c\u4e3a2\u4e2a\u6574\u6570n\u548cT\uff081\u2264n\u226450\uff0c1\u2264T\u2264500\uff09\uff0c\u7b2c2\u884c\u4e3an\u4e2a\u6574\u6570\uff0c\u4ee3\u8868\u5404\u987a\u5e8f\u63d0\u4ea4\u7684\u4efb\u52a1\u6240\u9700\u6d88\u8017\u7684\u670d\u52a1\u5668\u65f6\u95f4\u3002<br /></p>", |
||||||
|
"output_description": "<p>\u6bcf\u7ec4\u6d4b\u8bd5\u6570\u636e\u5360\u4e00\u884c\uff0c\u8f93\u51fa\u4e00\u4e2a\u6574\u6570\uff0c\u5373\u5728\u7ed9\u5b9a\u65f6\u95f4T\u5185\u80fd\u591f\u5b8c\u6210\u7684\u6700\u5927\u63d0\u4ea4\u6570\u3002<br /></p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "6 180\n45 30 55 20 80 20\n", |
||||||
|
"output": "4" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2022-06-17T19:02:14.715043Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 20, |
||||||
|
"memory_limit": 10, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "ACM", |
||||||
|
"difficulty": "Mid", |
||||||
|
"source": "", |
||||||
|
"total_score": 0, |
||||||
|
"submission_number": 17, |
||||||
|
"accepted_number": 6, |
||||||
|
"statistic_info": { |
||||||
|
"0": 6, |
||||||
|
"4": 5, |
||||||
|
"-1": 4, |
||||||
|
"-2": 2 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": null |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 2165, |
||||||
|
"tags": [ |
||||||
|
"ACM\u8bad\u7ec3", |
||||||
|
"DFS" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "2022-042", |
||||||
|
"title": "\u6253\u602a\u6e38\u620f", |
||||||
|
"description": "<p>\u4e00\u9897\u6811\u6709n\u4e2a\u8282\u70b9\uff08\u7f16\u53f7\u4ece0\u5230n-1\uff09\uff0c\u6811\u4e0a\u6bcf\u4e00\u4e2a\u8282\u70b9\u53ef\u80fd\u6709\u591a\u53ea\u602a\u7269\u3002 \u5c0f\u660e\u57280\u53f7\u8282\u70b9\uff0c\u4ed6\u60f3\u8981\u6e05\u9664\u8fd9\u68f5\u6811\u4e0a\u6240\u6709\u7684\u602a\u7269\u3002</p><p>\u4ed6\u73b0\u5728\u6709atk\u5927\u5c0f\u7684\u653b\u51fb\u529b\u3002\u53ea\u6709\u5f53\u4ed6\u7684\u653b\u51fb\u529b\u5927\u4e8e\u602a\u7269\u7684\u9632\u5fa1\u529b\u65f6\uff0c\u4ed6\u624d\u53ef\u4ee5\u6253\u8d25\u8be5\u602a\u7269\u3002\u6bcf\u6253\u8d25\u4e00\u53ea\u602a\u7269\uff0c\u8fd8\u4f1a\u589e\u52a0\u4e00\u5b9a\u7684\u653b\u51fb\u529b\u3002</p><p>\u4e00\u4e2a\u8282\u70b9\u53ef\u80fd\u5b58\u5728\u7740\u4e0d\u6b62\u4e00\u53ea\u602a\u517d\uff0c\u4f60\u8981\u6253\u8d25\u8fd9\u4e2a\u8282\u70b9\u7684\u6240\u6709\u602a\u7269\u624d\u80fd\u53ef\u4ee5\u4ece\u8fd9\u4e2a\u8282\u70b9\u901a\u8fc7\uff0c</p><p>\u8bf7\u95ee\u4ed6\u80fd\u4e0d\u80fd\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\uff1f</p><p>\u6ce8\u610f\uff1a\u4e0d\u8981\u6c42\u4e00\u6b21\u6027\u6740\u5149\u4e00\u4e2a\u8282\u70b9\u91cc\u9762\u7684\u6240\u6709\u602a\u7269\u3002</p>", |
||||||
|
"input_description": "<p>\u542b\u591a\u7ec4\u6d4b\u8bd5\u6570\u636e\u3002</p><p>\u6bcf\u7ec4\u6d4b\u8bd5\u6570\u636e\u7684\u7b2c1\u884c\u5305\u542b\u4e24\u4e2a\u6574\u6570n\uff0cm\uff0c\u5206\u522b\u8868\u793a\u8fd9\u68f5\u6811\u6709n\u4e2a\u8282\u70b9\uff0cm\u53ea\u602a\u517d(1<=n<=1000 ,0<=m <=100)</p><p>\u63a5\u4e0b\u6765\u7684n-1\u884c\uff08\u5373\u7b2c2\u81f3n\u884c\uff09\uff0c\u6bcf\u884c\u4e24\u4e2a\u6574\u6570u\uff0cv\uff0c\u8868\u793a\u7f16\u53f7\u4e3au\uff0cv\u4e4b\u95f4\u7684\u8282\u70b9\u6709\u4e00\u6761\u65e0\u5411\u8fb9\uff0c\u4fdd\u8bc1\u4e0d\u4f1a\u6210\u73af\u3002\uff080<=u,v<n , u!=v)</p><p>\u63a5\u4e0b\u6765\u76841\u884c\u5305\u542b\u4e00\u4e2a\u6574\u6570atk\uff0c\u8868\u793a\u5c0f\u660e\u7684\u521d\u59cb\u5316\u653b\u51fb\u529b(0<=atk<=100)</p><p>\u63a5\u4e0b\u6765\u7684m\u884c\uff0c\u6bcf\u884c3\u4e2a\u6574\u6570id\uff0cdef\uff0cadd_atk\uff0c\u8868\u793a\u5728\u7f16\u53f7\u4e3aid\u7684\u70b9\u4e0a\uff0c\u6709\u4e00\u53ea\u9632\u5fa1\u529b\u4e3adef\u7684\u602a\u7269\uff0c\u6253\u8d25\u540e\u53ef\u4ee5\u589e\u52a0add_atk\u70b9\u7684\u653b\u51fb\u529b\u3002(0<=add_atk,def<=100)</p>", |
||||||
|
"output_description": "<p>\u5bf9\u4e8e\u6bcf\u7ec4\u6d4b\u8bd5\u6837\u4f8b\uff0c\u5982\u679c\u5c0f\u660e\u80fd\u591f\u6e05\u9664\u6240\u6709\u7684\u602a\u7269\uff0c\u5219\u8f93\u51fa\u201cOh yes.\u201d \u5426\u5219\uff0c\u8f93\u51fa\u201cGood Good Study,Day Day Up.\u201d<br /></p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "5 2\n0 1\n0 2\n2 3\n2 4\n11\n3 10 2\n1 11 0\n", |
||||||
|
"output": "Oh yes." |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2022-06-17T19:05:25.707056Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 10, |
||||||
|
"memory_limit": 100, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "ACM", |
||||||
|
"difficulty": "Mid", |
||||||
|
"source": "", |
||||||
|
"total_score": 0, |
||||||
|
"submission_number": 2, |
||||||
|
"accepted_number": 2, |
||||||
|
"statistic_info": { |
||||||
|
"0": 2 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": null |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 1, |
||||||
|
"tags": [ |
||||||
|
"C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1", |
||||||
|
"\u7b2c1\u7ae0 \u6982\u8ff0" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 4, |
||||||
|
"username": "iyua", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "C1001", |
||||||
|
"title": "This is a C program", |
||||||
|
"description": "<p>\u8f93\u51fa\u4e00\u884c\u5b57\u7b26\u4e32</p><pre><code class=\"lang-text\">\nThis is a C program\n\n</code></pre>", |
||||||
|
"input_description": "<p>\u65e0\u8f93\u5165</p>", |
||||||
|
"output_description": "<p>\u8f93\u51fa\u4e00\u884c\u5b57\u7b26\u4e32</p><pre><code class=\"lang-text\">\nThis is a C program\n\n</code></pre>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": " ", |
||||||
|
"output": "This is a C program" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2021-07-14T10:52:11.442215Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "\u6559\u6750\u4f8b1.3", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 3930, |
||||||
|
"accepted_number": 1360, |
||||||
|
"statistic_info": { |
||||||
|
"0": 1360, |
||||||
|
"4": 153, |
||||||
|
"-1": 358, |
||||||
|
"-2": 2059 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 29, |
||||||
|
"tags": [ |
||||||
|
"C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1", |
||||||
|
"\u7b2c1\u7ae0 \u6982\u8ff0" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "C1002", |
||||||
|
"title": "\u6c422\u4e2a\u6574\u6570\u7684\u6700\u5927\u503c", |
||||||
|
"description": "<p>\u4ece\u952e\u76d8\u8f93\u51652\u4e2a\u6574\u6570\uff0c\u8f93\u51fa\u5176\u4e2d\u8f83\u5927\u7684\u4e00\u4e2a\u503c\u3002<br /></p>", |
||||||
|
"input_description": "<p>\u5728\u4e00\u884c\u4e2d\u5305\u542b2\u4e2a\u6574\u6570\uff0c\u6574\u6570\u4e4b\u95f4\u7528\u7a7a\u683c\u9694\u5f00\u3002</p>", |
||||||
|
"output_description": "<p>\u5728\u4e00\u884c\u4e2d\u8f93\u51fa2\u4e2a\u6574\u6570\u7684\u6700\u5927\u503c\u3002</p><p>\u8f93\u51fa\u683c\u5f0f\u4e3a\uff1amax=\u6700\u5927\u6574\u6570\u503c<br /><br /></p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "1 2", |
||||||
|
"output": "max=2" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2021-08-03T15:12:54.968317Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "\u6559\u6750\u4f8b1.4", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 4392, |
||||||
|
"accepted_number": 1045, |
||||||
|
"statistic_info": { |
||||||
|
"0": 1045, |
||||||
|
"4": 128, |
||||||
|
"8": 119, |
||||||
|
"-1": 722, |
||||||
|
"-2": 2378 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 30, |
||||||
|
"tags": [ |
||||||
|
"C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1", |
||||||
|
"\u7b2c1\u7ae0 \u6982\u8ff0" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": { |
||||||
|
"C": "\n" |
||||||
|
}, |
||||||
|
"_id": "C1003", |
||||||
|
"title": "\u8bbe\u8ba1\u51fd\u6570\u6c422\u4e2a\u6574\u6570\u7684\u6700\u5927\u503c", |
||||||
|
"description": "<p><span style=\"color: rgb(73, 80, 96);\">\u4ece\u952e\u76d8\u8f93\u51652\u4e2a\u6574\u6570\uff0c\u8f93\u51fa\u5176\u4e2d\u8f83\u5927\u7684\u4e00\u4e2a\u503c\u3002</span><br /></p><p><span style=\"color: rgb(73, 80, 96);\">\u5c06\u6c422\u4e2a\u6574\u6570\u6700\u5927\u503c\u7684\u4efb\u52a1\u5b9a\u4e49\u6210\u4e00\u4e2a\u51fd\u6570\u3002</span></p><p>\u4e0b\u9762\u65f6\u6574\u4e2a\u7a0b\u5e8f\u7684\u57fa\u672c\u6846\u67b6\uff0c<span style=\"color: rgb(227, 55, 55);\">\u63d0\u4ea4\u65f6\uff0c\u53ea\u9700\u8981\u63d0\u4ea4\u4f60\u7684\u4ee3\u7801\u3002</span></p><p>#include <stdio.h></p><p><span style=\"color: rgb(227, 55, 55);\">//\u4e0b\u9762\u662f\u4f60\u7684\u4ee3\u7801\u6240\u5728\u4f4d\u7f6e</span></p><p><span style=\"color: rgb(227, 55, 55);\">\u3002\u3002\u3002\u3002\u3002\u3002</span></p><p><span style=\"color: rgb(227, 55, 55);\">//\u4f60\u7684\u4ee3\u7801\u7ed3\u675f</span></p><p>int main()</p><p>{<br /></p><p style=\"margin-left: 40px;\">int a,b,c;</p><p style=\"margin-left: 40px;\">scanf("%d%d",&a,&b);</p><p style=\"margin-left: 40px;\">c=max(a,b);</p><p style=\"margin-left: 40px;\">printf("%d", c);</p><p style=\"margin-left: 40px;\">return 0;</p><p>}</p>", |
||||||
|
"input_description": "<p><span style=\"color: rgb(73, 80, 96);\">\u5728\u4e00\u884c\u4e2d\u5305\u542b2\u4e2a\u6574\u6570\uff0c\u6574\u6570\u4e4b\u95f4\u7528\u7a7a\u683c\u9694\u5f00\u3002</span><br /></p>", |
||||||
|
"output_description": "<p>\u5728\u4e00\u884c\u4e2d\u8f93\u51fa2\u4e2a\u6574\u6570\u7684\u6700\u5927\u503c\u3002</p><p>\u8f93\u51fa\u683c\u5f0f\u4e3a\uff1a\u6700\u5927\u6574\u6570\u503c</p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "1 2", |
||||||
|
"output": "2" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"input": "1 1", |
||||||
|
"output": "1" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C" |
||||||
|
], |
||||||
|
"create_time": "2021-08-03T15:25:26.916251Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "\u6559\u6750\u4f8b1.5", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 4022, |
||||||
|
"accepted_number": 814, |
||||||
|
"statistic_info": { |
||||||
|
"0": 814, |
||||||
|
"4": 8, |
||||||
|
"8": 30, |
||||||
|
"-1": 124, |
||||||
|
"-2": 3046 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 31, |
||||||
|
"tags": [ |
||||||
|
"\u57fa\u7840" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "C1004", |
||||||
|
"title": "Hello World!", |
||||||
|
"description": "<p>\u7f16\u5199\u7a0b\u5e8f\uff0c\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5982\u4e0b\u4fe1\u606f\u3002</p><p>Hello World!</p>", |
||||||
|
"input_description": "<p>\u65e0</p>", |
||||||
|
"output_description": "<p>\u6309\u7167\u8981\u6c42\u8f93\u51fa\u4e0a\u8ff0\u4fe1\u606f\u3002</p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "\u65e0", |
||||||
|
"output": "Hello World!" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2021-08-03T15:30:32.170588Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "\u6559\u6750\u4e60\u98981.6", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 2032, |
||||||
|
"accepted_number": 895, |
||||||
|
"statistic_info": { |
||||||
|
"0": 895, |
||||||
|
"4": 61, |
||||||
|
"-1": 485, |
||||||
|
"-2": 591 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 32, |
||||||
|
"tags": [ |
||||||
|
"jichu" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "C1005", |
||||||
|
"title": "\u8f93\u51fa2\u884c\u4fe1\u606f", |
||||||
|
"description": "<p>\u7f16\u5199\u7a0b\u5e8f\uff0c\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5982\u4e0b\u4e24\u884c\u4fe1\u606f\u3002</p><p>Programing is fun.</p><p>Programing in language C is even more fun!</p>", |
||||||
|
"input_description": "<p>\u65e0<br /></p>", |
||||||
|
"output_description": "<p><span style=\"color: rgb(73, 80, 96);\">\u6309\u7167\u8981\u6c42\u8f93\u51fa\u4e0a\u8ff02\u884c\u4fe1\u606f\u3002</span><br /></p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "\u65e0", |
||||||
|
"output": "Programing is fun.\nPrograming in language C is even more fun!" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2021-08-03T15:58:32.473463Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "\u6559\u6750\u4e60\u98981.7", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 2759, |
||||||
|
"accepted_number": 887, |
||||||
|
"statistic_info": { |
||||||
|
"0": 887, |
||||||
|
"4": 19, |
||||||
|
"-1": 900, |
||||||
|
"-2": 953 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 36, |
||||||
|
"tags": [ |
||||||
|
"C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1", |
||||||
|
"\u7b2c1\u7ae0 \u6982\u8ff0" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "C1006", |
||||||
|
"title": "\u6c422\u4e2a\u6574\u6570\u7684\u548c", |
||||||
|
"description": "<p>\u7f16\u5199\u7a0b\u5e8f\uff0c\u4ece\u952e\u76d8\u8f93\u5165\u4e24\u4e2a\u6574\u6570\uff0c\u8f93\u51fa\u5b83\u4eec\u7684\u548c\u3002</p>", |
||||||
|
"input_description": "<p>\u4e00\u884c\u4e2d\u5305\u542b2\u4e2a\u6574\u6570\uff0c\u4e2d\u95f4\u7528\u7a7a\u683c\u9694\u5f00\u3002</p>", |
||||||
|
"output_description": "<p>\u8f93\u51fa2\u4e2a\u6574\u6570\u7684\u548c\u3002<br /></p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "3 4", |
||||||
|
"output": "7" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2021-08-15T12:20:28.645137Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "\u6559\u6750\u4e60\u98981.8", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 3690, |
||||||
|
"accepted_number": 856, |
||||||
|
"statistic_info": { |
||||||
|
"0": 856, |
||||||
|
"4": 176, |
||||||
|
"-1": 1184, |
||||||
|
"-2": 1474 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 37, |
||||||
|
"tags": [ |
||||||
|
"C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1", |
||||||
|
"\u7b2c1\u7ae0 \u6982\u8ff0" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "C1007", |
||||||
|
"title": "\u6c42\u5706\u7684\u9762\u79ef\u548c\u5468\u957f", |
||||||
|
"description": "<p>\u7f16\u5199\u7a0b\u5e8f\uff0c\u8f93\u5165\u5706\u7684\u534a\u5f84\uff0c\u8f93\u51fa\u5706\u7684\u9762\u79ef\u548c\u5468\u957f\u3002</p>", |
||||||
|
"input_description": "<p>\u65e0</p>", |
||||||
|
"output_description": "<p>\u6c42\u5706\u7684\u9762\u79ef\u548c\u5468\u957f<br /></p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "1", |
||||||
|
"output": "3.140000\n6.280000" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "<p>$\\pi \u53d6\u503c 3.14 $</p>", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2021-08-15T12:21:39.706064Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "\u6559\u6750\u4e60\u98981.9", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 8974, |
||||||
|
"accepted_number": 871, |
||||||
|
"statistic_info": { |
||||||
|
"0": 871, |
||||||
|
"4": 210, |
||||||
|
"8": 2018, |
||||||
|
"-1": 3431, |
||||||
|
"-2": 2444 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
"id": 145, |
||||||
|
"tags": [ |
||||||
|
"C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1", |
||||||
|
"\u7b2c2\u7ae0 \u6570\u636e\u7c7b\u578b\u3001\u8fd0\u7b97\u7b26\u548c\u8868\u8fbe\u5f0f" |
||||||
|
], |
||||||
|
"created_by": { |
||||||
|
"id": 39, |
||||||
|
"username": "admin", |
||||||
|
"real_name": null |
||||||
|
}, |
||||||
|
"template": {}, |
||||||
|
"_id": "C2001", |
||||||
|
"title": "\u8f93\u51fa\u56db\u4f4d\u6574\u6570\u7684\u5404\u4f4d\u6570\u5b57", |
||||||
|
"description": "<p>\u7f16\u5199\u7a0b\u5e8f\uff0c\u8f93\u51fa\u4e00\u4e2a\u56db\u4f4d\u6574\u6570\u7684\u5404\u4f4d\u6570\u5b57\u3002<br /></p>", |
||||||
|
"input_description": "<p><span style=\"color: rgb(51, 51, 51);\">\u4e00\u4e2a\u56db\u4f4d\u6b63\u6574\u6570\u3002</span><br /></p>", |
||||||
|
"output_description": "<p>\u6309\u7167\u6837\u4f8b\u8981\u6c42\u683c\u5f0f\u8f93\u51fa\u3002</p><p>\u683c\u5f0f\uff1a\u56db\u4f4d\u6574\u6570=\u4e2a\u4f4d\u6570\u5b57+\u5341\u4f4d\u6570\u5b57*10+\u767e\u4f4d\u6570\u5b57*100+\u5343\u4f4d\u6570\u5b57*1000</p>", |
||||||
|
"samples": [ |
||||||
|
{ |
||||||
|
"input": "1234", |
||||||
|
"output": "1234=4+3*10+2*100+1*1000" |
||||||
|
} |
||||||
|
], |
||||||
|
"hint": "", |
||||||
|
"languages": [ |
||||||
|
"C", |
||||||
|
"C++", |
||||||
|
"Golang", |
||||||
|
"Java", |
||||||
|
"Python2", |
||||||
|
"Python3" |
||||||
|
], |
||||||
|
"create_time": "2021-09-18T17:36:47.967046Z", |
||||||
|
"last_update_time": null, |
||||||
|
"time_limit": 1000, |
||||||
|
"memory_limit": 256, |
||||||
|
"io_mode": { |
||||||
|
"input": "input.txt", |
||||||
|
"output": "output.txt", |
||||||
|
"io_mode": "Standard IO" |
||||||
|
}, |
||||||
|
"spj": false, |
||||||
|
"spj_language": null, |
||||||
|
"rule_type": "OI", |
||||||
|
"difficulty": "Low", |
||||||
|
"source": "", |
||||||
|
"total_score": 100, |
||||||
|
"submission_number": 3369, |
||||||
|
"accepted_number": 753, |
||||||
|
"statistic_info": { |
||||||
|
"0": 753, |
||||||
|
"1": 3, |
||||||
|
"4": 175, |
||||||
|
"8": 140, |
||||||
|
"-1": 1283, |
||||||
|
"-2": 1015 |
||||||
|
}, |
||||||
|
"share_submission": false, |
||||||
|
"contest": null, |
||||||
|
"my_status": 0 |
||||||
|
} |
||||||
|
], |
||||||
|
"total": 571 |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
## 示例{{index}}: |
||||||
|
|
||||||
|
### 输入: |
||||||
|
``` |
||||||
|
{{inputExamples}} |
||||||
|
``` |
||||||
|
|
||||||
|
### 输出: |
||||||
|
|
||||||
|
``` |
||||||
|
{{outputExamples}} |
||||||
|
``` |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@ |
|||||||
|
# {{title}} |
||||||
|
|
||||||
|
-------------------------------- |
||||||
|
## 题目: |
||||||
|
|
||||||
|
{{description}} |
||||||
|
|
||||||
|
## 输入: |
||||||
|
> {{inputDescription}} |
||||||
|
|
||||||
|
## 输出: |
||||||
|
> {{outputDescription}} |
||||||
|
|
||||||
|
-------------------------------- |
||||||
|
## 提示:{{hint}} |
||||||
|
|
||||||
|
{{examples}} |
||||||
|
|
||||||
|
-------------------------------- |
||||||
|
- 时间限制:{{timeLimit}} |
||||||
|
- 内存限制:{{memoryLimit}} |
||||||
|
|
||||||
|
- 等级:{{level}} |
||||||
|
- id:{{id}} |
||||||
|
- 标签:{{tags}} |
@ -0,0 +1,13 @@ |
|||||||
|
package me.lensfrex.test; |
||||||
|
|
||||||
|
import net.lensfrex.oj.collector.Collector; |
||||||
|
|
||||||
|
public class Test { |
||||||
|
public static void main(String[] args) { |
||||||
|
new Test().test(); |
||||||
|
} |
||||||
|
|
||||||
|
public void test() { |
||||||
|
// new Collector()
|
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue