Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0a9978cb3
|
||
|
|
2820c84507 | ||
|
|
fbd41d8ac7
|
No files matched your search
@@ -1,3 +1,7 @@
|
|||||||
# NCPC
|
# NCPC26!!
|
||||||
|
|
||||||
Hi, this is my journy thru out NCPC, check the forks for the year you are intrested to check.
|
This branch contains the code for NCPC 2026
|
||||||
|
here we have 3 folder containing all problems
|
||||||
|
- py: The python code
|
||||||
|
- java: The java code
|
||||||
|
- c: The c
|
||||||
Generated
+10
@@ -0,0 +1,10 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Ignored default folder with query files
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int ship_x, ship_y;
|
||||||
|
int treasure_x, treasure_y;
|
||||||
|
int direction_x, direction_y;
|
||||||
|
int movement_help;
|
||||||
|
|
||||||
|
scanf("%d %d", &ship_x, &ship_y);
|
||||||
|
scanf("%d %d", &treasure_x, &treasure_y);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while (((ship_x == treasure_x) && (ship_y == treasure_y))==0){
|
||||||
|
direction_x = ship_x - treasure_x;
|
||||||
|
direction_y = ship_y - treasure_y;
|
||||||
|
|
||||||
|
//diagonal movement
|
||||||
|
if (abs(direction_x) == abs(direction_y)){
|
||||||
|
//NortEeast movment
|
||||||
|
if((direction_x < 0) && (direction_y < 0)){
|
||||||
|
printf("NE\n");
|
||||||
|
ship_x -= direction_x;
|
||||||
|
ship_y -= direction_y;
|
||||||
|
}
|
||||||
|
//NortWest movement
|
||||||
|
else if((direction_x > 0) && (direction_y < 0)){
|
||||||
|
printf("NW\n");
|
||||||
|
ship_x -= direction_x;
|
||||||
|
ship_y -= direction_y;
|
||||||
|
}
|
||||||
|
//SouthWest movement
|
||||||
|
else if((direction_x > 0) && (direction_y > 0)){
|
||||||
|
printf("SW\n");
|
||||||
|
ship_x -= direction_x;
|
||||||
|
ship_y -= direction_y;
|
||||||
|
}
|
||||||
|
//SouthEast movement
|
||||||
|
else if((direction_x < 0) && (direction_y > 0)){
|
||||||
|
printf("SE\n");
|
||||||
|
ship_x -= direction_x;
|
||||||
|
ship_y -= direction_y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if((abs(direction_x) != abs(direction_y))){
|
||||||
|
//horisontal / vertical movement
|
||||||
|
if(abs(direction_x) > abs(direction_y)){
|
||||||
|
movement_help = abs(abs(direction_x) - abs(direction_y));
|
||||||
|
//East movement
|
||||||
|
if(direction_x < 0){
|
||||||
|
printf("E\n");
|
||||||
|
ship_x += movement_help;
|
||||||
|
}
|
||||||
|
//West movement
|
||||||
|
if(direction_x > 0){
|
||||||
|
printf("W\n");
|
||||||
|
ship_x -= movement_help;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(abs(direction_x) < abs(direction_y)){
|
||||||
|
movement_help = abs( abs(direction_y) - abs(direction_x));
|
||||||
|
//North Movement
|
||||||
|
if(direction_y < 0){
|
||||||
|
printf("N\n");
|
||||||
|
ship_y += movement_help;
|
||||||
|
}
|
||||||
|
//South Movement
|
||||||
|
if(direction_y > 0){
|
||||||
|
printf("S\n");
|
||||||
|
ship_y -= movement_help;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Generated
+1
-2
@@ -4,8 +4,7 @@
|
|||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="KubernetesApiProvider"><![CDATA[{}]]></component>
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#Sat Oct 04 11:03:43 CEST 2025
|
#Sat Oct 03 11:00:43 CEST 2026
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
File renamed without changes.
Vendored
+89
-89
@@ -1,89 +1,89 @@
|
|||||||
@rem
|
@rem
|
||||||
@rem Copyright 2015 the original author or authors.
|
@rem Copyright 2015 the original author or authors.
|
||||||
@rem
|
@rem
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
:omega
|
:omega
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'java'
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class B {
|
||||||
|
record Pair<K, V>(K key, V value)
|
||||||
|
{}
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
String input = br.readLine();
|
||||||
|
int n = Integer.parseInt(input.split(" ")[0]);
|
||||||
|
int k = Integer.parseInt(input.split(" ")[1]);
|
||||||
|
int[] slots = new int[k];
|
||||||
|
HashMap<String>
|
||||||
|
for(int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
input = br.readLine();
|
||||||
|
int org = Integer.parseInt(input.split(" ")[0])-1;
|
||||||
|
int dest = Integer.parseInt(input.split(" ")[1])-1;
|
||||||
|
slots[org]--;
|
||||||
|
slots[dest]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
long redudent = Arrays.stream(slots).filter((i) -> i == 0).count();
|
||||||
|
|
||||||
|
System.out.println(redudent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
public class D {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
String spondee = "--";
|
||||||
|
String trocha = "-u";
|
||||||
|
String dactyl = "-uu";
|
||||||
|
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
String in = br.readLine();
|
||||||
|
|
||||||
|
int spondees = 0;
|
||||||
|
int dactyls = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
if(in.startsWith(spondee))
|
||||||
|
{
|
||||||
|
spondees++;
|
||||||
|
in = in.substring(spondee.length());
|
||||||
|
}
|
||||||
|
else if(in.startsWith(dactyl))
|
||||||
|
{
|
||||||
|
dactyls++;
|
||||||
|
in = in.substring(dactyl.length());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("no");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!(spondees + dactyls == 5))
|
||||||
|
{
|
||||||
|
System.out.println("no");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(in.length() > 2)
|
||||||
|
{
|
||||||
|
System.out.println("no");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!(in.endsWith(spondee) || in.endsWith(trocha)))
|
||||||
|
{
|
||||||
|
System.out.println("no");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System.out.println("yes");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class E {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
char[][] nums = {
|
||||||
|
// 0
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'.', '.', '.', '.',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.'
|
||||||
|
},
|
||||||
|
// 1
|
||||||
|
{
|
||||||
|
'.', '.', '.', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '.'
|
||||||
|
},
|
||||||
|
// 2
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '.',
|
||||||
|
'#', '.', '.', '.',
|
||||||
|
'.', '#', '#', '.'
|
||||||
|
},
|
||||||
|
// 3
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.'
|
||||||
|
},
|
||||||
|
// 4
|
||||||
|
{
|
||||||
|
'.', '.', '.', '.',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '.'
|
||||||
|
},
|
||||||
|
// 5
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '.',
|
||||||
|
'#', '.', '.', '.',
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.'
|
||||||
|
},
|
||||||
|
// 6
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '.',
|
||||||
|
'#', '.', '.', '.',
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.'
|
||||||
|
},
|
||||||
|
// 7
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '.'
|
||||||
|
},
|
||||||
|
// 8
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.'
|
||||||
|
},
|
||||||
|
// 9
|
||||||
|
{
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'#', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '.', '.', '#',
|
||||||
|
'.', '#', '#', '.'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for(int i = 0; i < 7; i++)
|
||||||
|
{
|
||||||
|
sb.append(br.readLine());
|
||||||
|
}
|
||||||
|
|
||||||
|
char[] input = sb.toString().toCharArray();
|
||||||
|
|
||||||
|
ArrayList<Integer> posibleNums = new ArrayList<>();
|
||||||
|
|
||||||
|
for(int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
if(Arrays.equals(nums[i], input))
|
||||||
|
{
|
||||||
|
posibleNums.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!posibleNums.isEmpty())
|
||||||
|
{
|
||||||
|
System.out.println(posibleNums.get(0));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 10; i < 100; i++)
|
||||||
|
{
|
||||||
|
char[] compiledNum = compileNum(nums, i);
|
||||||
|
if(Arrays.equals(compiledNum, input))
|
||||||
|
{
|
||||||
|
posibleNums.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(posibleNums.isEmpty())
|
||||||
|
{
|
||||||
|
System.out.println("impossible");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
posibleNums.sort(Integer::compareTo);
|
||||||
|
|
||||||
|
sb = new StringBuilder();
|
||||||
|
|
||||||
|
StringBuilder finalSb = sb;
|
||||||
|
posibleNums.forEach((i) -> {
|
||||||
|
finalSb.append(i).append(" ");
|
||||||
|
});
|
||||||
|
String output = sb.toString().trim();
|
||||||
|
System.out.println(output);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static char[] compileNum(char[][] nums, int i)
|
||||||
|
{
|
||||||
|
int tio = i / 10;
|
||||||
|
int ett = i % 10;
|
||||||
|
|
||||||
|
char[] out = new char[28];
|
||||||
|
|
||||||
|
for(int j = 0; j < 28; j++)
|
||||||
|
{
|
||||||
|
out[j] = nums[tio][j] == nums[ett][j] ? '.' : '#';
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class I {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
String crewStr = br.readLine();
|
||||||
|
String hermit1Str = br.readLine();
|
||||||
|
String hermit2Str = br.readLine();
|
||||||
|
String hermit3Str = br.readLine();
|
||||||
|
int crew = Integer.parseInt(crewStr);
|
||||||
|
int hermit1 = Integer.parseInt(hermit1Str);
|
||||||
|
int hermit2 = Integer.parseInt(hermit2Str);
|
||||||
|
int hermit3 = Integer.parseInt(hermit3Str);
|
||||||
|
|
||||||
|
ArrayList<Integer> hermits = new ArrayList<>();
|
||||||
|
hermits.add(hermit1);
|
||||||
|
hermits.add(hermit2);
|
||||||
|
hermits.add(hermit3);
|
||||||
|
|
||||||
|
hermits.sort(Integer::compareTo);
|
||||||
|
|
||||||
|
if(hermits.get(0) + crew >= hermits.get(1))
|
||||||
|
{
|
||||||
|
System.out.println("impossible");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println(hermits.get(0) + crew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class K {
|
||||||
|
|
||||||
|
static record Pair<K, V>(K key, V value)
|
||||||
|
{}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
|
||||||
|
int numTrees = Integer.parseInt(br.readLine());
|
||||||
|
ArrayList<Pair<Integer, Integer>> trees = new ArrayList<>();
|
||||||
|
for(int i = 0; i < numTrees; i++)
|
||||||
|
{
|
||||||
|
String str = br.readLine();
|
||||||
|
int i1 = Integer.parseInt(str.split(" ")[0]);
|
||||||
|
int i2 = Integer.parseInt(str.split(" ")[1]);
|
||||||
|
trees.add(new Pair<>(i1, i2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
for line in sys.stdin:
|
||||||
|
pices = int(line)
|
||||||
|
|
||||||
|
if (pices == 0):
|
||||||
|
print(0)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
arr = list()
|
||||||
|
arr = map(int, input().split())
|
||||||
|
|
||||||
|
ar = sorted(arr)
|
||||||
|
|
||||||
|
half = ar[pices-1] / 2
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
index = 0
|
||||||
|
closest = 1001
|
||||||
|
|
||||||
|
if (pices == 1):
|
||||||
|
print(ar[0])
|
||||||
|
exit()
|
||||||
|
|
||||||
|
while ar[i] <= half:
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
if i > 0:
|
||||||
|
if (ar[i] - half) <= closest:
|
||||||
|
closest = (ar[i] - half)
|
||||||
|
index = i
|
||||||
|
if (half - ar[i-1]) <= closest:
|
||||||
|
closest = (ar[i-1] - half)
|
||||||
|
index = i-1
|
||||||
|
else:
|
||||||
|
index = 0
|
||||||
|
|
||||||
|
print(max((ar[pices-1] - ar[index]), ar[index]))
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
3
|
||||||
|
400 199 201
|
||||||
|
3
|
||||||
|
400 202 199
|
||||||
|
3
|
||||||
|
400 201 198
|
||||||
|
2
|
||||||
|
500 100
|
||||||
|
2
|
||||||
|
101 99
|
||||||
|
3
|
||||||
|
100 100 100
|
||||||
|
3
|
||||||
|
100 200 300
|
||||||
|
3
|
||||||
|
1000 1 1
|
||||||
|
3
|
||||||
|
1000 500 100
|
||||||
|
3
|
||||||
|
100 101 99
|
||||||
|
3
|
||||||
|
100 150 50
|
||||||
|
4
|
||||||
|
200 400 200 100
|
||||||
|
7
|
||||||
|
100 100 900 500 500 1000 400
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
3
|
||||||
|
401 600 1000
|
||||||
|
3
|
||||||
|
1 600 1000
|
||||||
|
2
|
||||||
|
1 2
|
||||||
|
2
|
||||||
|
1 1
|
||||||
|
3
|
||||||
|
1 1 2
|
||||||
|
4
|
||||||
|
1 2 1 1
|
||||||
|
4
|
||||||
|
1 2 2 1
|
||||||
|
4
|
||||||
|
1 2 2 2
|
||||||
|
4
|
||||||
|
400 1000 1000 1000
|
||||||
|
5
|
||||||
|
1000 1000 1000 998 22
|
||||||
|
4
|
||||||
|
300 500 150 100
|
||||||
Whitespace-only changes.
@@ -1 +0,0 @@
|
|||||||
rootProject.name = 'NCPC-g'
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.kattis.ncpc25.log.rider;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class A {
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
int[] nums = getComponents(Integer.parseInt(in.readLine()));
|
|
||||||
System.out.println(nums[0] + " " + nums[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int[] getComponents(int input)
|
|
||||||
{
|
|
||||||
int num = new Random().nextInt(-999, 1000);
|
|
||||||
int num2 = 0;
|
|
||||||
if(num == 0)
|
|
||||||
{
|
|
||||||
num = new Random().nextInt(-999, 1000);
|
|
||||||
}
|
|
||||||
if(num < input)
|
|
||||||
{
|
|
||||||
num2 = input-num;
|
|
||||||
}
|
|
||||||
else if (input < 0 && input < num) {
|
|
||||||
num2 = input - num;
|
|
||||||
}
|
|
||||||
else if (num > input) {
|
|
||||||
num2 = input - num;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
num +=1;
|
|
||||||
num2 -= 1;
|
|
||||||
}
|
|
||||||
if(num >= 1000 || num <= -1000 || num2 >= 1000 || num2 <= -1000)
|
|
||||||
return getComponents(input);
|
|
||||||
return new int[]{num, num2};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
package com.kattis.ncpc25.log.rider;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.MissingFormatArgumentException;
|
|
||||||
|
|
||||||
public class C {
|
|
||||||
|
|
||||||
public static final int MINUTES_IN_A_DAY = 1_440;
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception{
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
String start = in.readLine();
|
|
||||||
String end = in.readLine();
|
|
||||||
|
|
||||||
String out = countTime(start, end);
|
|
||||||
System.out.println(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String countTime(String start, String end)
|
|
||||||
{
|
|
||||||
if(start.equalsIgnoreCase(end))
|
|
||||||
{
|
|
||||||
return "7 days";
|
|
||||||
}
|
|
||||||
|
|
||||||
int startTime = formatedTimeToMin(start);
|
|
||||||
int endTime = formatedTimeToMin(end);
|
|
||||||
|
|
||||||
if(endTime < startTime)
|
|
||||||
{
|
|
||||||
endTime += MINUTES_IN_A_DAY*7;
|
|
||||||
}
|
|
||||||
|
|
||||||
int totalTime = endTime-startTime;
|
|
||||||
|
|
||||||
int days = totalTime / MINUTES_IN_A_DAY;
|
|
||||||
int hours = (totalTime - (days * MINUTES_IN_A_DAY)) / 60;
|
|
||||||
int minutes = (totalTime - (days * MINUTES_IN_A_DAY) - (hours * 60));
|
|
||||||
|
|
||||||
int components = 0;
|
|
||||||
if(days > 0)
|
|
||||||
{
|
|
||||||
components += 1;
|
|
||||||
}
|
|
||||||
if(hours > 0)
|
|
||||||
{
|
|
||||||
components += 1;
|
|
||||||
}
|
|
||||||
if(minutes > 0)
|
|
||||||
{
|
|
||||||
components += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder out = new StringBuilder();
|
|
||||||
if(days > 0)
|
|
||||||
{
|
|
||||||
out.append(days).append(" day").append((days == 1?"":"s"));
|
|
||||||
}
|
|
||||||
if(hours > 0)
|
|
||||||
{
|
|
||||||
if(!out.isEmpty())
|
|
||||||
{
|
|
||||||
if(components == 2)
|
|
||||||
{
|
|
||||||
out.append(" and ");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
out.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.append(hours).append(" hour").append((hours == 1?"":"s"));
|
|
||||||
}
|
|
||||||
if(minutes > 0)
|
|
||||||
{
|
|
||||||
if(!out.isEmpty())
|
|
||||||
{
|
|
||||||
if(components == 2)
|
|
||||||
{
|
|
||||||
out.append(" and ");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
out.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.append(minutes).append(" minute").append((minutes == 1?"":"s"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return out.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int formatedTimeToMin(String formated)
|
|
||||||
{
|
|
||||||
String day, time;
|
|
||||||
day = formated.split(" ")[0];
|
|
||||||
time = formated.split(" ")[1];
|
|
||||||
int min = 0;
|
|
||||||
|
|
||||||
min += switch (day) {
|
|
||||||
case "Mon" -> MINUTES_IN_A_DAY;
|
|
||||||
case "Tue" -> MINUTES_IN_A_DAY*2;
|
|
||||||
case "Wed" -> MINUTES_IN_A_DAY*3;
|
|
||||||
case "Thu" -> MINUTES_IN_A_DAY*4;
|
|
||||||
case "Fri" -> MINUTES_IN_A_DAY*5;
|
|
||||||
case "Sat" -> MINUTES_IN_A_DAY*6;
|
|
||||||
case "Sun" -> MINUTES_IN_A_DAY*7;
|
|
||||||
default -> 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
String hour = time.split(":")[0];
|
|
||||||
String minute = time.split(":")[1];
|
|
||||||
|
|
||||||
min += Integer.parseInt(minute);
|
|
||||||
min += Integer.parseInt(hour)*60;
|
|
||||||
|
|
||||||
return min;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.kattis.ncpc25.log.rider;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class D {
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
int count = Integer.parseInt(in.readLine());
|
|
||||||
Point[] points = new Point[count];
|
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
String line = in.readLine();
|
|
||||||
int n1 = Integer.parseInt(line.split(" ")[0]);
|
|
||||||
int n2 = Integer.parseInt(line.split(" ")[1]);
|
|
||||||
points[i] = new Point(n1, n2);
|
|
||||||
}
|
|
||||||
|
|
||||||
double length = getTotalLength(points);
|
|
||||||
System.out.println(length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getTotalLength(Point[] points)
|
|
||||||
{
|
|
||||||
points = sort(points);
|
|
||||||
double out = 0;
|
|
||||||
Point pLast = null;
|
|
||||||
for(Point p : points)
|
|
||||||
{
|
|
||||||
if(pLast == null)
|
|
||||||
{
|
|
||||||
pLast = p;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
out += pLast.distance(p);
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Point[] sort(Point[] in)
|
|
||||||
{
|
|
||||||
ArrayList<Point> out = new ArrayList<>();
|
|
||||||
ArrayList<Point> left = new ArrayList<>(Arrays.stream(in).toList());
|
|
||||||
Point p1, p2, p3;
|
|
||||||
if(!left.isEmpty()) p1 = left.removeFirst();
|
|
||||||
if(!left.isEmpty()) p2 = left.removeFirst();
|
|
||||||
if(!left.isEmpty()) p3 = left.removeFirst();
|
|
||||||
|
|
||||||
//if(p3 == null)
|
|
||||||
//{
|
|
||||||
// out.put
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if(p1.distance(p3))
|
|
||||||
|
|
||||||
return out.toArray(new Point[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.kattis.ncpc25.log.rider;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class G {
|
|
||||||
public static void main(String[] args) throws IOException {
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
int n,m,k;
|
|
||||||
String line = in.readLine();
|
|
||||||
n = Integer.parseInt(line.split(" ")[0]);
|
|
||||||
m = Integer.parseInt(line.split(" ")[1]);
|
|
||||||
k = Integer.parseInt(line.split(" ")[2]);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package com.kattis.ncpc25.log.rider;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
public static void main(String[] args) throws IOException {
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
String line = in.readLine();
|
|
||||||
long N = Long.parseLong(line.split(" ")[0]);
|
|
||||||
long E = Long.parseLong(line.split(" ")[1]);
|
|
||||||
String out = jump(N, E);
|
|
||||||
System.out.println(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String jump(long N, long E)
|
|
||||||
{
|
|
||||||
ArrayList<Integer> levels = new ArrayList<>();
|
|
||||||
int count = 0;
|
|
||||||
int diff = 0;
|
|
||||||
long time = 0;
|
|
||||||
boolean inf = false;
|
|
||||||
boolean first = true;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
time += E;
|
|
||||||
if(time % N == 0 && !first)
|
|
||||||
{
|
|
||||||
E++;
|
|
||||||
if(count < 11){
|
|
||||||
diff++;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
E--;
|
|
||||||
if(count < 11){
|
|
||||||
diff--;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(count >= 10)
|
|
||||||
{
|
|
||||||
if(diff == 0)
|
|
||||||
{
|
|
||||||
inf = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(first) first = false;
|
|
||||||
}
|
|
||||||
while (E > 0);
|
|
||||||
if(inf)
|
|
||||||
{
|
|
||||||
return "infinity";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return time+"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.kattis.ncpc25.log.rider;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
public class K {
|
|
||||||
public static void main(String[] args) throws IOException {
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
int num = Integer.parseInt(in.readLine());
|
|
||||||
String[] signs = new String[num];
|
|
||||||
for(int i = 0; i < num; i++)
|
|
||||||
{
|
|
||||||
signs[i] = in.readLine();
|
|
||||||
}
|
|
||||||
int lastTop = 0;
|
|
||||||
int lastTopRound = 0;
|
|
||||||
for(String l : signs)
|
|
||||||
{
|
|
||||||
if(l.equalsIgnoreCase("/"))
|
|
||||||
{
|
|
||||||
System.out.println(lastTopRound);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int limit = Integer.parseInt(l);
|
|
||||||
if(limit > lastTopRound)
|
|
||||||
{
|
|
||||||
int tmp = (int)Math.ceil(limit/10.0)*10;
|
|
||||||
if(tmp == 90)
|
|
||||||
{
|
|
||||||
lastTopRound = 100;
|
|
||||||
}
|
|
||||||
else if(tmp <= 160)
|
|
||||||
{
|
|
||||||
lastTopRound = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println(limit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
import com.kattis.ncpc25.log.rider.A;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
public class ATest {
|
|
||||||
@Test
|
|
||||||
public void ATests()
|
|
||||||
{
|
|
||||||
assertTrue(test(-4));
|
|
||||||
assertTrue(test(57));
|
|
||||||
assertTrue(test(-302));
|
|
||||||
assertTrue(test(476));
|
|
||||||
assertTrue(test(999));
|
|
||||||
assertTrue(test(-999));
|
|
||||||
assertTrue(test(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean test(int in)
|
|
||||||
{
|
|
||||||
int[] nums = A.getComponents(in);
|
|
||||||
int num = nums[0] + nums[1];
|
|
||||||
if(nums[0] == 0 || nums[1] == 0){
|
|
||||||
System.out.println("etleast one is 0");
|
|
||||||
System.out.println(in + " = " + nums[0] + " + " + nums[1]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if((""+Math.abs(nums[0])).length() >= 4 || (""+Math.abs(nums[1])).length() >= 4){
|
|
||||||
System.out.println(in + " = " + nums[0] + " + " + nums[1]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(num != in)
|
|
||||||
{
|
|
||||||
System.out.println(in + " = " + nums[0] + " + " + nums[1]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import com.kattis.ncpc25.log.rider.C;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
public class CTest {
|
|
||||||
@Test
|
|
||||||
public void CTestCases()
|
|
||||||
{
|
|
||||||
assertEquals("7 hours", C.countTime("Mon 08:00", "Mon 15:00"));
|
|
||||||
assertEquals("7 days", C.countTime("Mon 08:00", "Mon 08:00"));
|
|
||||||
assertEquals("2 minutes", C.countTime("Mon 08:00", "Mon 08:02"));
|
|
||||||
assertEquals("1 hour and 59 minutes", C.countTime("Mon 22:00", "Mon 23:59"));
|
|
||||||
assertEquals("7 days", C.countTime("Mon 08:00", "Mon 08:00"));
|
|
||||||
assertEquals("7 days", C.countTime("Mon 08:00", "Mon 08:00"));
|
|
||||||
assertEquals("7 days", C.countTime("Mon 08:00", "Mon 08:00"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import com.kattis.ncpc25.log.rider.D;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
public class DTest {
|
|
||||||
@Test
|
|
||||||
public void DTests()
|
|
||||||
{
|
|
||||||
assertTrue(testMaxDiff(D.getTotalLength(new Point[]{new Point(-1, -7), new Point(-1, -11), new Point(0, -9), new Point(2, 2), new Point(1, -2), new Point(-2, -1), new Point(3, 1), new Point(-1, -5), new Point(0, -3), new Point(-3, -11)}), 17.186912));
|
|
||||||
assertTrue(testMaxDiff(D.getTotalLength(new Point[]{new Point(1, 0), new Point(0,0), new Point(1,1)}), 2));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean testMaxDiff(double value, double excpected)
|
|
||||||
{
|
|
||||||
if(value == excpected) return true;
|
|
||||||
return value <= excpected + Math.pow(10, -6) && value >= excpected - Math.pow(10, -6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
import com.kattis.ncpc25.log.rider.J;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
public class JTest {
|
|
||||||
@Test
|
|
||||||
public void JTest1()
|
|
||||||
{
|
|
||||||
assertEquals("59",J.jump(7, 9));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest2()
|
|
||||||
{
|
|
||||||
assertEquals("infinity", J.jump(7,4));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest9()
|
|
||||||
{
|
|
||||||
assertEquals("infinity", J.jump(7,4));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest3()
|
|
||||||
{
|
|
||||||
assertEquals("7581167638793024", J.jump(100001, 123123123));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest4()
|
|
||||||
{
|
|
||||||
assertEquals("infinity", J.jump(5, 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest5()
|
|
||||||
{
|
|
||||||
assertEquals("0", J.jump(1, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest6()
|
|
||||||
{
|
|
||||||
assertEquals("21", J.jump(16, 6));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest7()
|
|
||||||
{
|
|
||||||
assertEquals("10", J.jump(11, 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void JTest8()
|
|
||||||
{
|
|
||||||
assertEquals("210", J.jump(67, 20));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user