Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a00567502
|
||
|
|
39396cedd3 |
No files matched your search
File renamed without changes.
Generated
-2
@@ -3,8 +3,6 @@
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
+17
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="KubernetesApiProvider"><![CDATA[{}]]></component>
|
||||
<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" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,3 +0,0 @@
|
||||
# NCPC26 final practive
|
||||
|
||||
This branch contaisn the code from the final practice(18th september 2026) for NCPC26!
|
||||
@@ -2,7 +2,7 @@ plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group = 'com.kattis.ncpc26.pf'
|
||||
group = 'org.example'
|
||||
version = '1.0-SNAPSHOT'
|
||||
|
||||
repositories {
|
||||
@@ -10,7 +10,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation platform('org.junit:junit-bom:6.0.0')
|
||||
testImplementation platform('org.junit:junit-bom:5.10.0')
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
Vendored
File renamed without changes.
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Fri Sep 18 10:45:37 CEST 2026
|
||||
#Sat Oct 04 11:03:43 CEST 2025
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
File renamed without changes.
File renamed without changes.
-10
@@ -1,10 +0,0 @@
|
||||
# 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
|
||||
@@ -1 +0,0 @@
|
||||
rootProject.name = 'NCPC26-practive-final'
|
||||
@@ -0,0 +1 @@
|
||||
rootProject.name = 'NCPC-g'
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.kattis.ncpc26.p2.pending;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class D {
|
||||
public static void main(String[] args) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
char[][] board = new char[8][8];
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
board[i] = br.readLine().toCharArray();
|
||||
}
|
||||
|
||||
int[][] dig = {
|
||||
{1,1}, {-1,1}, {-1,1}, {-1,-1}
|
||||
};
|
||||
|
||||
for(int bx = 0; bx < 8; bx++)
|
||||
{
|
||||
for(int by = 0; by < 8; by++)
|
||||
{
|
||||
if(board[bx][by] == '*')
|
||||
{
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
if(i == bx) continue;
|
||||
if(board[i][by] == '*')
|
||||
{
|
||||
System.out.println("invalid");
|
||||
return;
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
if(i == by) continue;
|
||||
if(board[bx][i] == '*')
|
||||
{
|
||||
System.out.println("invalid");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
int[] mod = dig[i];
|
||||
int x = mod[0];
|
||||
int y = mod[1];
|
||||
int base = (i==0?0:7);
|
||||
for(int j = 0; j < 8; j++)
|
||||
{
|
||||
if(base+x*j == bx && y*j == by) continue;
|
||||
if(board[base+x*j][y*j] == '*')
|
||||
{
|
||||
System.out.println("invalid");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("valid");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.kattis.ncpc26.p2.pending;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class E {
|
||||
public static void main(String[] args) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
int n = Integer.parseInt(br.readLine());
|
||||
|
||||
int[] maxNumber = new int[n];
|
||||
int[] minNumber = new int[n];
|
||||
|
||||
for(int i = 0; i < n; i++)
|
||||
{
|
||||
String hexNum = br.readLine().toUpperCase(Locale.ROOT);
|
||||
|
||||
if(hexNum.length() > 1 && (hexNum.startsWith("0") || hexNum.startsWith("D")))
|
||||
{
|
||||
hexNum = "d" + hexNum.substring(1);
|
||||
}
|
||||
{
|
||||
minNumber[i] = Integer.parseInt(hexNum.replaceAll("B", "8").replaceAll("D", "0"), 16);
|
||||
maxNumber[i] = Integer.parseInt(hexNum.replaceAll("8", "B").replaceAll("0", "D"), 16);
|
||||
}
|
||||
}
|
||||
|
||||
int maxOut = 0;
|
||||
int minOut = 0;
|
||||
|
||||
for(int i = 0; i < n; i++) {
|
||||
minOut += minNumber[i];
|
||||
maxOut += maxNumber[i];
|
||||
}
|
||||
|
||||
System.out.println(Integer.toHexString(maxOut).toUpperCase(Locale.ROOT));
|
||||
System.out.println(Integer.toHexString(minOut).toUpperCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
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