Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f62e35eb0
|
||
|
|
f9af40293e
|
||
|
|
67a2198180
|
||
|
|
e260c51b70
|
No files matched your search
Generated
-16
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<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
@@ -1,11 +0,0 @@
|
|||||||
<?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
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# NCPC
|
# NCPC26 final practive
|
||||||
|
|
||||||
Hi, this is my journy thru out NCPC, check the forks for the year you are intrested to check.
|
This branch contaisn the code from the final practice(18th september 2026) for NCPC26!
|
||||||
Generated
+2
@@ -3,6 +3,8 @@
|
|||||||
/workspace.xml
|
/workspace.xml
|
||||||
# Editor-based HTTP Client requests
|
# Editor-based HTTP Client requests
|
||||||
/httpRequests/
|
/httpRequests/
|
||||||
|
# Ignored default folder with query files
|
||||||
|
/queries/
|
||||||
# Datasource local storage ignored files
|
# Datasource local storage ignored files
|
||||||
/dataSources/
|
/dataSources/
|
||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int array[26];
|
||||||
|
int time = 0;
|
||||||
|
char problem;
|
||||||
|
char RightOrWrong[10];
|
||||||
|
int sum = 0;
|
||||||
|
int solved = 0;
|
||||||
|
int is_solved[26];
|
||||||
|
|
||||||
|
for (int i = 0 ; i < 26; i++){
|
||||||
|
is_solved[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < 26; i++)
|
||||||
|
{
|
||||||
|
array[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(scanf("%d %c %s", &time, &problem, &RightOrWrong) == 3 && time != -1){
|
||||||
|
|
||||||
|
|
||||||
|
switch (problem){
|
||||||
|
case 'A':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[0] += 20;
|
||||||
|
}else{
|
||||||
|
array[0] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[0] = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[1] += 20;
|
||||||
|
}else{
|
||||||
|
array[1] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[1] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[2] += 20;
|
||||||
|
}else{
|
||||||
|
array[2] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[2] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[3] += 20;
|
||||||
|
}else{
|
||||||
|
array[3] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[3] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'E':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[4] += 20;
|
||||||
|
}else{
|
||||||
|
array[4] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[4] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[5] += 20;
|
||||||
|
}else{
|
||||||
|
array[5] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[5] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'G':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[6] += 20;
|
||||||
|
}else{
|
||||||
|
array[6] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[6] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'H':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[7] += 20;
|
||||||
|
}else{
|
||||||
|
array[7] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[7] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[8] += 20;
|
||||||
|
}else{
|
||||||
|
array[8] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[8] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'J':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[9] += 20;
|
||||||
|
}else{
|
||||||
|
array[9] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[9] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'K':
|
||||||
|
if (strcmp(RightOrWrong, "wrong")==0){
|
||||||
|
array[10] += 20;
|
||||||
|
}else{
|
||||||
|
array[10] += time;
|
||||||
|
solved += 1;
|
||||||
|
is_solved[10] = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int i = 0; i <= 26; i++)
|
||||||
|
{
|
||||||
|
if(is_solved[i]==1){
|
||||||
|
sum += array[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printf("%d %d", solved, sum);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
File renamed without changes.
+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
|
||||||
@@ -2,7 +2,7 @@ plugins {
|
|||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'org.example'
|
group = 'com.kattis.ncpc26.pf'
|
||||||
version = '1.0-SNAPSHOT'
|
version = '1.0-SNAPSHOT'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -10,7 +10,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation platform('org.junit:junit-bom:5.10.0')
|
testImplementation platform('org.junit:junit-bom:6.0.0')
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
}
|
}
|
||||||
Vendored
File renamed without changes.
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#Sat Oct 04 11:03:43 CEST 2025
|
#Fri Sep 18 10:45:37 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.6.0-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'NCPC26-practive-final'
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.kattis.ncpc26.pf;
|
||||||
|
|
||||||
|
public class B {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.kattis.ncpc26.pf;
|
||||||
|
|
||||||
|
public class D {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.kattis.ncpc26.pf;
|
||||||
|
|
||||||
|
public class E {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.kattis.ncpc26.pf;
|
||||||
|
|
||||||
|
public class F {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.kattis.ncpc26.pf;
|
||||||
|
|
||||||
|
public class G {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.kattis.ncpc26.pf;
|
||||||
|
|
||||||
|
public class I {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
l = 0
|
||||||
|
r = 1001
|
||||||
|
m = 500
|
||||||
|
temp = m
|
||||||
|
|
||||||
|
for i in range(10):
|
||||||
|
print(m)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
term = input()
|
||||||
|
|
||||||
|
if term == "correct":
|
||||||
|
exit()
|
||||||
|
elif term == "lower":
|
||||||
|
temp = m
|
||||||
|
m = (l + m) // 2
|
||||||
|
r = temp
|
||||||
|
else:
|
||||||
|
temp = m
|
||||||
|
m = (m + r) // 2
|
||||||
|
l = temp
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
ball = 1
|
||||||
|
|
||||||
|
for i in range(5):
|
||||||
|
j = int(input())
|
||||||
|
k = int(input())
|
||||||
|
|
||||||
|
if j == ball:
|
||||||
|
ball = k
|
||||||
|
elif k == ball:
|
||||||
|
ball = j
|
||||||
|
|
||||||
|
print(ball)
|
||||||
@@ -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