태그>easy(총 67개의 글)
'easy' 관련 최근글
-
- Inchworm
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/05/28 18:46
Code public class Inchworm { public int gcd(int a, int b) { return b=0 ? a : gcd(b,a%b); } int lcm(int a, int b) { return a*b / gcd(a,b); } public int lunchtime(int branch, int rest, int leaf) { return branch/lcm(rest,leaf) ..
Topcoder, Easy, 250p, Math, Simulation
- Inchworm
-
- Rochambo
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/05/27 05:04
Code public class Rochambo { public int wins(String opponent) { int w=0; if(opponent.charAt(0) = 'S') w+; if(opponent.charAt(1) = 'S') w+; for (int i=2; i < opponent.length(); i+) { char c; if(opponent.charAt(i-2)..
- Rochambo
-
- StringTrain
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/05/27 04:14
Code public class StringTrain{ public String buildTrain(String[] cars) { String train = cars[0]; for (int i=1; i < cars.length; i+) { for (int j = cars[i].length()-1; j > 0; j-) { String s1 = cars[i].substring(0,j); if (!trai..
- StringTrain
-
- Scale
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/05/14 06:04
Code public class Scale{ public String[] scale(int x, int y, String[] image) { int m = image.length; int n = image[0].length(); char[][] big = new char[y*m][x*n]; String[] sol = new String[y]; for(int i=0; i < y; ..
- Scale
-
- TennisRallies
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/04/13 12:02
Code public class TennisRallies{ int rec(int index, int numLength, String curr, int allowed, String[] forbidden) { if(index = numLength) return 1; int ret = 0; for (char stroke = 'c'; stroke <= 'd'; stroke+) { int newAllowed ..
- TennisRallies
-
- DQuads
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/03/24 07:36
Code public class DQuads{ public int count(String[] flights) { int n = flights.length; int count=0; int[][] a = new int[n][n]; for (int i=0; i < n; i+) { if(flights[i].length() = 0) continue; String[] s = flights[i].spl..
- DQuads
-
- GasStations
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/03/10 00:42
Code public class GasStations{ public double tripCost(int[] dist, int[] price, int _mpg, int tankSize, int tripLength) { if(_mpg*tankSize >= tripLength) return 0; int N = dist.length, lowerPrice=20001, idx=0; double lowes..
- GasStations
-
- Circuits
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/03/03 14:15
Code public class Circuits{ public int howLong(String[] connects, String[] costs) { int N = connects.length; int cost[][] = new int[N][N]; for(int i=0; i<N; i+) if(!connects[i].equals("")) { String ..
- Circuits
-
- PickTeam
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/02/28 14:14
Code import java.util.Arrays; public class PickTeam{ int n, bestSum; int[] team; int[][] nums; String[] names, bestTeam; void recur(int idx, int size) { if(size = team.length) { int sum=0; for(int i=0; i < team.length; ..
- PickTeam
-
- TicSolver
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2019/02/17 07:03
Code public class TicSolver{ char[][] board; char ch; int[] y1 = {0,0,2,2,1,0,0,0}; int[] x1 = {0,2,2,0,0,1,0,2}; int[] y2 = {0,1,2,1,1,1,1,1}; int[] x2 = {1,2,1,0,1,1,1,1}; int[] y3 = {0,2,2,0,1,2,2,2}; int..
- TicSolver
-
- FaceFinder
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2018/06/22 04:24
Code import java.util.LinkedList;import java.awt.Point;public class FaceFinder{ int[][] m; void floodfill(int x, int y) { int[] dx = {0,0,1,-1}; int[] dy = {1,-1,0,0}; Linke..
- FaceFinder
-
- PossibleOrders
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2018/06/21 16:44
Code public class PossibleOrders{ int N; long sum; long comb(long n, long r) { long denom=1, numer=1; while (r > 0) {denom *= n-; numer *= r-;} return denom / numer; } void calcul(long[] cnt, int rem, int min) { for (..
- PossibleOrders
-
- SkewTree
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2018/06/20 16:33
Code public class SkewTree{ int[] probs; int[][] best; int getAccess(int i1, int i2) { int total=0; for (int i=i1; i <= i2; i+) total = probs[i]; return total; } int getBest(int i1, int i2) { if(i1 > i2) return 0; if(best[i1][i2]!=0) ..
- SkewTree
-
- GreedyChange
-
불타는 아잍(IT)스크림 by 불타는 아이스크림|2018/06/19 17:20
Code import java.util.Arrays;public class GreedyChange{ public int smallest(int[] denoms) { Arrays.sort(denoms); int max = denoms[denoms.length-1]*2; int[] mins = new int[max+1]; for (int i=1; i<=max; i+) mins[..
- GreedyChange