USACO
给高中生培训USACO,该专栏会将一些JAVA题解公开
lincs_
分布式系统、区块链、机器学习
展开
-
[Java] Preface Numbering
Problem 92: Preface Numbering Preface Numbering A certain book's prefaces are numbered in upper case Roman numerals.Traditional Roman numeral values use a single letter to represent acertain subset of decimal numbers. Here is the standard set: ..原创 2021-03-10 21:55:15 · 120 阅读 · 0 评论 -
[Java] Party Lamps
Party Lamps Party LampsIOI 98To brighten up the gala dinner of the IOI'98 we have a set of N(10 <= N <= 100) colored lamps numbered from 1 to N.The lamps are connected to four buttons:Button 1: When this button is pressed, all the lamps c..原创 2021-03-10 11:19:59 · 100 阅读 · 0 评论 -
[Java] Runaround Numbers
Problem 57: Runaround Numbers Runaround Numbers Runaround numbers are integers with unique digits, none of which iszero (e.g., 81362) that also have an interesting property, exemplifiedby this demonstration:If you start at the left digit (8 in ou..原创 2021-03-07 11:18:34 · 90 阅读 · 0 评论 -
[Java] Subset Sums
Subset Sums Subset SumsJRMFor many sets of consecutive integers from 1 through N (1 <= N<= 39), one can partition the set into two sets whose sums areidentical.For example, if N=3, one can partition the set {1, 2, 3} in one way sothat..原创 2021-03-03 11:29:23 · 157 阅读 · 0 评论 -
[Java] Hamming Codes
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: hamming*/import java.io.*;import java.util.*;public class hamming { private int N; private int B; private int D; p原创 2021-01-17 23:27:42 · 99 阅读 · 2 评论 -
[Java] Healthy Holsteins
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: holstein*/import java.io.*;import java.util.*;public class holstein { private int V; private int G; private Set<I原创 2021-01-15 20:41:03 · 149 阅读 · 2 评论 -
[Java] Sorting A Three-Valued Sequence
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: sort3*/import java.io.*;import java.util.*;public class sort3 { private void swap (int[] array, int a, int b) { int原创 2021-01-15 19:20:13 · 104 阅读 · 0 评论 -
[Java] Ordered Fractions
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: frac1*/import java.io.*;import java.util.*;class Fraction implements Comparable<Fraction> { private int molecula原创 2021-01-14 20:15:16 · 121 阅读 · 2 评论 -
[Java] The Castle
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: castle*/import java.io.*;import java.util.*;class Room { private int id; private boolean west = false; private boole原创 2021-01-14 17:40:33 · 187 阅读 · 0 评论 -
[Java] Superprime Rib
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: sprime*/import java.io.*;import java.util.*;public class sprime { private boolean isPrime (int num) { if (num == 1)原创 2021-01-11 11:19:30 · 53 阅读 · 0 评论 -
[Java] Number Triangles
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: numtri*/import java.io.*;import java.util.*;public class numtri { public numtri() throws IOException { // Use Buffe原创 2021-01-10 14:17:47 · 98 阅读 · 0 评论 -
[Java] Prime Palindromes
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: pprime*/import java.io.*;import java.util.*;public class pprime { private boolean isPrime(int num) { for (int i = 2原创 2021-01-10 12:21:08 · 98 阅读 · 0 评论 -
[Java] Mother‘s Milk
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: milk3*/import java.io.*;import java.util.*;public class milk3 { private int A; private int B; private int C; pri原创 2021-01-08 22:53:35 · 393 阅读 · 1 评论 -
[Java] Arithmetic Progressions
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: ariprog*/import java.io.*;import java.util.*;public class ariprog { private int MAX; private boolean DFS(int a, int原创 2021-01-07 21:04:18 · 117 阅读 · 0 评论 -
[Java] Wormholes
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: wormhole*/import java.io.*;import java.util.*;class Point implements Comparable<Point> { public int getX() { r原创 2021-01-06 23:03:56 · 118 阅读 · 3 评论 -
[Java] Ski Course Design
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: skidesign*/import java.io.*;import java.util.*;public class skidesign { public skidesign() throws IOException { //原创 2021-01-05 19:17:49 · 141 阅读 · 3 评论 -
[Java] Combination Lock
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: combo*/import java.io.*;import java.util.*;public class combo { private void count(int N, BufferedReader f, Set<St原创 2021-01-04 18:40:34 · 187 阅读 · 0 评论 -
[Java] Prime Cryptarithm
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: crypt1*/import java.io.*;import java.util.*;public class crypt1 { private Set<Integer> generate(int[] digits) {原创 2021-01-04 11:37:04 · 123 阅读 · 8 评论 -
[Java] Barn Repair
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: barn1*/import java.io.*;import java.util.*;public class barn1 { private int count(int M, int start, int end, boolean[原创 2021-01-02 11:38:24 · 93 阅读 · 1 评论 -
[Java] Mixing Milk
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: milk*/import java.io.*;import java.util.*;class Farmer implements Comparable<Farmer> { private int price; pr原创 2020-12-31 12:19:09 · 112 阅读 · 0 评论 -
[Java] Dual Palindromes
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: dualpal*/import java.io.*;import java.util.*;public class dualpal { private String radix = "0123456789"; private boo原创 2020-12-30 19:03:05 · 92 阅读 · 0 评论 -
[Java] Palindromic Squares
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: palsquare*/import java.io.*;import java.util.*;public class palsquare { private int B; private boolean isPalindromic原创 2020-12-30 17:17:37 · 133 阅读 · 4 评论 -
[Java] Name That Number
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: namenum*/import java.io.*;import java.util.*;public class namenum { private String number; private Map<Character,原创 2020-12-30 16:04:36 · 104 阅读 · 1 评论 -
[Java] Transformations
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: transform */import java.io.*;import java.util.*;public class transform { private void swap(char[][] a, int i1, int j1原创 2020-12-30 13:02:07 · 155 阅读 · 0 评论 -
[Java] Milking Cows
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: milk2 */import java.io.*;import java.util.*;public class milk2 { private final int MAXLENGTH = 1000000; public milk2(原创 2020-12-29 12:01:13 · 135 阅读 · 0 评论 -
[Java] Broken Necklace
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: beads */import java.io.*;import java.util.*;class beads { public beads() throws IOException { // Use BufferedReader原创 2020-12-28 21:40:28 · 141 阅读 · 0 评论 -
[Java] Friday the Thirteenth
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: friday*/import java.io.*;import java.util.*;public class friday { private final int WEEK = 7; private final int MONTH原创 2020-12-28 12:02:40 · 142 阅读 · 2 评论 -
[Java] Task ‘gift1‘: Greedy Gift Givers
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: gift1*/import java.io.*;import java.util.*;class gift1 { public static void main (String [] args) throws IOException {原创 2020-12-27 09:41:07 · 133 阅读 · 0 评论 -
[Java] test
/* Use the slash-star style comments or the system won't see your identification information *//*ID: lincans1LANG: JAVATASK: test*/import java.io.*;import java.util.*;class test { public static void main (String [] args) throws IOException {原创 2020-12-26 10:37:59 · 137 阅读 · 1 评论 -
[Java] Your Ride Is Here
/* Use the slash-star style comments or the system won't see your identification information *//*ID: CanShu LinLANG: JAVATASK: ride*/import java.io.*;import java.util.Scanner;class ride { public static int count(String str) { int num = 1;原创 2020-12-26 10:22:39 · 100 阅读 · 0 评论