Skip to content

Instantly share code, notes, and snippets.

View dalcon10028's full-sized avatar
🐟

dalcon dalcon10028

🐟
View GitHub Profile
import java.util.*;
public class Main {
static int N, M;
static int []num;
static boolean []visited;
static StringBuilder sb = new StringBuilder();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt(); // μ’…λ₯˜
int K = sc.nextInt(); // λ§žμΆ”λ €λŠ” κ°’
int []coin = new int[N];
int sum=0; // ν•„μš”ν•œ λ™μ „κ°œμˆ˜μ˜ ν•© (λ‹΅)
public int[] solution(int[] heights) {
int []answer = new int[heights.length]; // μ΄ˆκΈ°ν™”, intλŠ” κΈ°λ³Έκ°’ 0
for(int i=heights.length-1; i>=0; i--){ // 맨 λ’€ μš”μ†ŒλΆ€ν„° ν™•μΈν•©λ‹ˆλ‹€.
int tower = heights[i]; // 맨 λ’€ μš”μ†Œ λ„£κΈ°
for(int j=i-1; j>=0 ;j--){ // 맨 λ’€ μš”μ†Œμ˜ λ°”λ‘œ μ•ž μš”μ†ŒλΆ€ν„° 맨 μ•ž μš”μ†ŒκΉŒμ§€ ν™•μΈν•©λ‹ˆλ‹€.
if (tower < heights[j]) { // μ•žμ— μš”μ†Œμ€‘ 맨 λ’€ μš”μ†Œλ³΄λ‹€ 큰 게 있으면 체크
answer[i] = j+1; // 1λΆ€ν„° μ„ΈκΈ° λ•Œλ¬Έμ— 인덱슀 + 1
break;
}
}
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
while (true) {
int num1 = sc.nextInt();
int num2 = sc.nextInt();
if (num1+num2==0) break; // 두 μž…λ ₯값이 0이면 μ’…λ£Œ
if (num2 % num1 == 0) { // μ•½μˆ˜λΌλ©΄
@dalcon10028
dalcon10028 / main.js
Created January 9, 2020 09:07
MySQL with Node.js
const mysql = require('mysql');
var mysqlConnection = mysql.createConnection({
host : '13.124.119.246',
user : 'root',
password : 'root',
database : 'USER',
port : '56891'
});
@dalcon10028
dalcon10028 / main.js
Created January 9, 2020 09:27
MySQL with Node.js
const mysql = require('mysql');
const express = require('express');
var app = express();
const bodyparser = require('body-parser');
app.use(bodyparser.json());
var mysqlConnection = mysql.createConnection({
host : '13.124.119.246',
user : 'root',
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int [][]schedule = new int[N][2]; // νšŒμ˜μ‹€μ˜ μˆ˜μ— λŒ€ν•œ μ‹œμž‘μ‹œκ°„κ³Ό λλ‚˜λŠ” μ‹œκ°„
for(int i=0; i<N; i++){
schedule[i][0] = sc.nextInt(); // μ‹œμž‘μ‹œκ°„
schedule[i][1] = sc.nextInt(); // λλ‚˜λŠ” μ‹œκ°„
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int []person = new int[N];
for(int i=0; i<N; i++)
person[i] = sc.nextInt();
sc.close();
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String exp = sc.next();
sc.close();
String []str = exp.split("-"); // '-' 기호 κΈ°μ€€μœΌλ‘œ 배열에 λ‹΄κΈ°
// 처음 '-'μ „κΉŒμ§€ λͺ¨λ‘ λ”ν•˜κΈ°
String []tmp = str[0].split("\\+");
import java.util.*;
class Solution {
public int[] solution(int[] progresses, int[] speeds) {
ArrayList<Integer> period = new ArrayList<>(); // 각 μž‘μ—…λ§ˆλ‹€ κ±Έλ¦¬λŠ” κΈ°κ°„
ArrayList<Integer> result = new ArrayList<>(); // κ²°κ³Ό κ°’
for(int i=0; i<speeds.length; i++){
double restProgress = 100-progresses[i];
period.add((int)(Math.ceil(restProgress/speeds[i]))); //각 μž‘μ—…μ— λŒ€ν•œ 배포가λŠ₯ν•œ λ‚ μ§œ
// [7, 3, 9]