본문 바로가기

전체 글

(150)
백준 2903 중앙 이동 알고리즘_JAVA https://www.acmicpc.net/problem/2903 2903번: 중앙 이동 알고리즘 상근이는 친구들과 함께 SF영화를 찍으려고 한다. 이 영화는 외계 지형이 필요하다. 실제로 우주선을 타고 외계 행성에 가서 촬영을 할 수 없기 때문에, 컴퓨터 그래픽으로 CG처리를 하려고 한다. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int dot = 2; int mul= 1; int n = sc.nextInt(); for(int i = 0 ; i < n ; i++){ dot+=mul; mul *= 2..
백준 2720 세탁소 사장 동혁_JAVA https://www.acmicpc.net/problem/2720 2720번: 세탁소 사장 동혁 각 테스트케이스에 대해 필요한 쿼터의 개수, 다임의 개수, 니켈의 개수, 페니의 개수를 공백으로 구분하여 출력한다. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int money; int[] change = {25,10,5,1}; int n = sc.nextInt(); for(int i = 0 ; i < n ; i++){ int[] arr = new int[4]; money = sc.nextInt(); for..
백준 2563 색종이_JAVA https://www.acmicpc.net/problem/2563 2563번: 색종이 가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록 www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int x , y, width=0 ; int[][] arr = new int[100][100]; int n = sc.nextInt(); for( int i = 0 ; i < n ; i..
백준 10798 세로읽기_JAVA https://www.acmicpc.net/problem/10798 10798번: 세로읽기 총 다섯줄의 입력이 주어진다. 각 줄에는 최소 1개, 최대 15개의 글자들이 빈칸 없이 연속으로 주어진다. 주어지는 글자는 영어 대문자 ‘A’부터 ‘Z’, 영어 소문자 ‘a’부터 ‘z’, 숫자 ‘0’ www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); char [][] arr = new char[5][15]; for(int i = 0 ; i < 5 ; i++){ String str = sc.next(); for(int j..
PHP Laravel8 더미값 생성 (Model,Factory 생성) 예제 1. 테이블 스키마 생성 및 정의 php artisan make:migration CreateProductsTable public function up() { Schema::create('products', function (Blueprint $table) { $table->id()->comment('상품id'); $table->string('name',255)->comment('상품명'); $table->bigInteger('price')->comment('상품금액'); $table->foreignId('user_id')->constrained('users'); $table->timestamps(); }); } php artisan migrate 2. factory와 Model 생성 php artisa..
백준 2566 최댓값_JAVA https://www.acmicpc.net/problem/2566 2566번: 최댓값 첫째 줄에 최댓값을 출력하고, 둘째 줄에 최댓값이 위치한 행 번호와 열 번호를 빈칸을 사이에 두고 차례로 출력한다. 최댓값이 두 개 이상인 경우 그 중 한 곳의 위치를 출력한다. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int [][] arr = new int[9][9]; int max = 0 ; int x = 0 ,y = 0; for (int i = 0 ; i max){ max = arr[i][j]; x = i; ..
백준 2738 행렬 덧셈_JAVA https://www.acmicpc.net/problem/2738 2738번: 행렬 덧셈 첫째 줄에 행렬의 크기 N 과 M이 주어진다. 둘째 줄부터 N개의 줄에 행렬 A의 원소 M개가 차례대로 주어진다. 이어서 N개의 줄에 행렬 B의 원소 M개가 차례대로 주어진다. N과 M은 100보다 작거나 같 www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int [][] arr1 = new int[N][M]; int [][] arr2 = n..
Laravel(artisan) 명령어 정리 artisan을 이용한 컨트롤러 생성 , model 생성 , 스키마 정의 php artisan make:controller ExController php artisan make:model Ex php artisan make:migration Ex_table 또는 한번에 생성 php artisan make:model Ex -mc 스키마 설정 파일 데이터베이스의 테이블로 생성 php artisan migrate tinker을 이용해 테이블 더미값 생성 (아래는 User의 예제) php artisan tinker User::factory()->count(5)->create() 결과값 라라벨 캐시 지우기 php atrisan config:clear php atrisan cache:clear php atrisan..