v-for 

반복문 처리 

 

<html> 

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> 

<body> 

 

<div class="container"> 

<h1>bootstrap test bootstrap test  bootstrap test </h1> 

<ul class="list-group"> 

<li v-for = "i in 11" class="list-group-item"> 

{{ i-1}} times 4 equals {{  (i-1) * 4 }} 

</li> 

</ul> 

</div> 

 

</body> 

 

 

 

 

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> 

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> 

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

<script> 

new Vue({ 

  el: '.container' 

}) 

 

 

</script> 

</html> 

 

 

 

<html> 

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> 

<body> 

 

<div class="container"> 

<h1>bootstrap test bootstrap test  bootstrap test </h1> 

<ul class="list-group"> 

<li v-for ="out in korean" class="list-group-item"> 

{{out}} 

</li> 

</ul> 

</div> 

 

</body> 

 

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> 

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> 

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

<script> 

new Vue({ 

  el: '.container' , 

  data : {korean :  [ 

"가", 

"나", 

"다", 

"라", 

"마" 

]} 

}) 

 

 

</script> 

</html> 

 

 

 

 

<html> 

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> 

<body> 

 

<div class="container"> 

<h1>bootstrap test bootstrap test  bootstrap test </h1> 

<ul class="list-group"> 

<li v-for ="out in korean" class="list-group-item"> 

{{out.word}}  // {{out.print}} 

</li> 

</ul> 

</div> 

 

</body> 

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> 

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> 

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

<script> 

new Vue({ 

el: '.container' , 

data : {korean :  [ 

{ word : "가",  print : "가나다"} , 

{ word :"나",  print :"가나다"} , 

{ word :"다", print :"가나다"} , 

{ word :"라", print :"가나다"} , 

{ word :"마" ,  print :"가나다"} , 

]} 

 

}) 

 

 

</script> 

</html> 

 

 

 

Index 추가할수있따. 

 

<ul class="list-group"> 

<li v-for ="(out , index)  in korean" class="list-group-item"> 

{{index}}  // {{out.word}}  // {{out.print}} 

</li> 

</ul> 

 

 

 

 

 

 

Key value로도 접근 가능 

 

<html> 

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> 

<body> 

 

<div class="container"> 

<h1>bootstrap test bootstrap test  bootstrap test </h1> 

<ul class="list-group"> 

<li v-for ="(value , key , index) in korean" class="list-group-item"> 

{{index}}  //  {{key}} // {{value}} 

</li> 

</ul> 

</div> 

 

</body> 

 

 

 

 

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> 

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> 

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

<script> 

new Vue({ 

el: '.container' , 

data : {korean :   

{ word : "가",  print : "가나다"} 

 

} 

 

}) 

 

궁금증이 생겼다 

이방법으로 리스트로 하면어떻게 될까 였다. 

 

<html> 

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> 

<body> 

 

<div class="container"> 

<h1>bootstrap test bootstrap test  bootstrap test </h1> 

<ul class="list-group"> 

<li v-for ="(value , index  , key) in korean" class="list-group-item"> 

  {{index}}  //  {{key}} // {{value}} 

 

</li> 

</ul> 

</div> 

 

</body> 

 

 

 

 

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> 

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> 

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

<script> 

new Vue({ 

el: '.container' , 

data : {korean :[ 

{ word : "가",  print : "가나다"}, 

{ word : "나",  print : "나다마"} 

 

]}   

 

}) 

 

 

</script> 

</html> 

 

 

 

아마도 v-for 인자값이 순서가 정해져있나보다 

 

 

 

</script> 

</html> 

 

공식 가이드를 보면 

 

 

 

item , index순서이다. 

 

 

 

하지만 요소가 3개일경우엔 

 

 

Item key index순서인거같다. 

 

 

 

자세한건 링크 

 

참조해야겠다. 

 

 

 

 


'오락기 > vue.js' 카테고리의 다른 글

상호 작용  (0) 2018.05.25
디렉티브  (0) 2018.05.25
vue vs jquery  (0) 2018.05.25
코어  (0) 2018.05.25

v-show 

v-if 

v-else 

 

 

v-show  - 엘리먼트 속성이 충족되었을때 보여준다. 

 

 

 

 

<html> 

<body> 

 

<div id = "app"> 

<h1>Text123</h1> 

<textarea v-model="message"></textarea> 

<!-- 

<button v-show="message"> send </button>  

--> 

<button v-show="message"> send </button>  

 

 

<pre> 

{{$data}} 

</pre> 

 

 

</div> 

 

</body> 

 

 

 

<!--<script src="http://code.jquery.com/jquery-latest.min.js"></script>--> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

 

<script> 

 

new Vue({ 

  el: '#app', 

  data: { 

message: '테스트입니다 v-show' 

  } 

}) 

 

 

</script> 

</html> 

 

글자를 한글자도 쓰면 

 

 

 

v-if  v-show 대신 사용할수있음 

 

 

<html> 

<body> 

 

<div id = "app"> 

<h1>Text123</h1> 

<textarea v-model="message"></textarea> 

<!-- 

<button v-show="message"> send </button>  

--> 

<button v-if="message"> send </button>  

 

 

<pre> 

{{$data}} 

</pre> 

 

 

</div> 

 

</body> 

 

 

 

<!--<script src="http://code.jquery.com/jquery-latest.min.js"></script>--> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

 

<script> 

 

new Vue({ 

  el: '#app', 

  data: { 

message: '테스트입니다 v-if' 

  } 

}) 

 

 

</script> 

</html> 

 

 

 

같은역활이지만 

v-if template 사용할수있따 v-show 사용불가능 

<html> 

<body> 

 

<div id = "app"> 

 

<template v-if="!message"> 

<h1> v-if template test</h1> 

</template> 

<textarea v-model="message"></textarea> 

<button v-show="message"> send </button>  

<pre> 

{{$data}} 

</pre> 

 

<!-- 

<h1>Text123</h1> 

<textarea v-model="message"></textarea> 

<button v-show="message"> send </button>  

<button v-if="message"> send </button>  

 

<pre> 

{{$data}} 

</pre> 

--> 

 

 

</div> 

 

</body> 

 

 

 

<!--<script src="http://code.jquery.com/jquery-latest.min.js"></script>--> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

 

<script> 

 

new Vue({ 

  el: '#app', 

  data: { 

message: '테스트입니다 v-if' 

  } 

}) 

 

 

</script> 

</html> 

 

 

코드에서보면 <template  message ! 없다면 이라고 되어있다 

따라서 메시지가 null일경우에는 보여지고 

메시지가 1글자라도있으면 버튼이 생기면서 

문구는 사라질것이다 

 

 

 

 

 

v-else 

 

<html> 

<body> 

 

<div id = "app"> 

 

<h1 v-if="!message"> v-if test</h1> 

<h2 v-else>  v-else  test </h2> 

</template> 

<textarea v-model="message"></textarea> 

<button v-show="message"> send </button>  

<pre> 

{{$data}} 

</pre> 

 

<!-- 

<h1>Text123</h1> 

<textarea v-model="message"></textarea> 

<button v-show="message"> send </button>  

<button v-if="message"> send </button>  

 

<pre> 

{{$data}} 

</pre> 

--> 

 

 

</div> 

 

</body> 

 

 

 

<!--<script src="http://code.jquery.com/jquery-latest.min.js"></script>--> 

<script src="https://cdn.jsdelivr.net/npm/vue"></script> 

 

<script> 

 

new Vue({ 

  el: '#app', 

  data: { 

message: '테스트입니다 v-if' 

  } 

}) 

 

 

</script> 

</html> 

 

코드상으로는 message 없으면 v-if 

있으면 else문이 동작되게 해놨씁니다 

 

 

 

 

 

 

단독으로 사용했을때 v-show v-if 차이점은? 

 

설명으로는 v-show 랜더링에  많은 리소스를 소모한다고 한다. 

따라서 가이드에 따르면 v-if 진정한 조건부 렌더링이라 한다. 

 

 

 


'오락기 > vue.js' 카테고리의 다른 글

상호 작용  (0) 2018.05.25
리스트 렌더링  (0) 2018.05.25
vue vs jquery  (0) 2018.05.25
코어  (0) 2018.05.25

<html>

<body>

아래는 vue.js 양방향 바인딩

<!--

<div id="app">

                  <h1>{{message}}</h1>

<input v-model = "message">

</div>

-->

아래는 제이쿼리 input tag keyup 이벤트

<div>

                  <h2>TEST</h2>

<input id='message'>

</div>

 

 

</body>

 

<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<!--<script src="https://cdn.jsdelivr.net/npm/vue"></script>-->

 

<script>

/*

new Vue({

  el: '#app',

  data: {

message: '이 페이지는 ' + new Date() + ' 에 로드 되었습니다'

  }

})

*/

 

$('#message').on( 'keyup' , function() {

var message = $('#message') .val();

$('h2').text(message);

})

 

</script>

</html>


'오락기 > vue.js' 카테고리의 다른 글

상호 작용  (0) 2018.05.25
리스트 렌더링  (0) 2018.05.25
디렉티브  (0) 2018.05.25
코어  (0) 2018.05.25

<!DOCTYPE html>

<html>

<head>

  <title>My first Vue app</title>

  <script src="https://unpkg.com/vue"></script>

</head>

<body>

  <div id="app">

    {{ message }}

  </div>

 

  <div id="app-2">

  <span v-bind:title="message">

    내 위에 잠시 마우스를 올리면 동적으로 바인딩 된 title을 볼 수 있습니다!

  </span>

</div>

 

<div id="app-3">

  <p v-if="seen">이제 나를 볼 수 있어요</p>

</div>

 

<div id="app-4">

  <ol>

    <li v-for="todo in todos">

      {{ todo.text }}

    </li>

  </ol>

</div>

 

<div id="app-5">

  <p>{{ message }}</p>

  <button v-on:click="reverseMessage">메시지 뒤집기</button>

</div>

 

<div id="app-6">

  <p>{{ message }}</p>

  <input v-model="message">

</div>

 

  <div id="app-7">

  <ol>

    <!--

      이제 각 todo-item 에 todo 객체를 제공합니다.

      화면에 나오므로, 각 항목의 컨텐츠는 동적으로 바뀔 수 있습니다.

      또한 각 구성 요소에 "키"를 제공해야합니다 (나중에 설명 됨).

     -->

    <todo-item

      v-for="item in groceryList"

      v-bind:todo="item"

      v-bind:key="item.id">

    </todo-item>

  </ol>

</div>

 

  <script>

    var app = new Vue({

      el: '#app',

      data: {

        message: 'Hello Vue!'

      }

    })

 

var app2 = new Vue({

  el: '#app-2',

  data: {

message: '123   이 페이지는 ' + new Date() + ' 에 로드 되었습니다'

  }

})

 

var app3 = new Vue({

  el: '#app-3',

  data: {

seen: true

  }

})

 

var app4 = new Vue({

  el: '#app-4',

  data: {

todos: [

  { text: 'JavaScript 배우기' },

  { text: 'Vue 배우기' },

  { text: '무언가 멋진 것을 만들기' },

  { text123: '무언가 멋진 것을 만들기' },

  { text: '무언가 멋진 것을 만들기' }

]

  }

})

 

var app5 = new Vue({

el: '#app-5',

  data: {

message: '안녕하세요! Vue.js!'

  },

  methods: {

reverseMessage: function () {

  this.message = this.message.split('').reverse().join('')

}

  }

})

 

var app6 = new Vue({

el: '#app-6',

data: {

message: '안녕하세요 Vue!'

}

})

 

Vue.component('todo-item', {

  props: ['todo'],

  template: '<li>{{ todo.text }}</li>'

})

 

var app7 = new Vue({

  el: '#app-7',

  data: {

    groceryList: [

      { id: 0, text: 'Vegetables' },

      { id: 1, text: 'Cheese' },

      { id: 2, text: 'Whatever else humans are supposed to eat' }

    ]

  }

 })

 

 

  </script>

</body>

</html>


'오락기 > vue.js' 카테고리의 다른 글

상호 작용  (0) 2018.05.25
리스트 렌더링  (0) 2018.05.25
디렉티브  (0) 2018.05.25
vue vs jquery  (0) 2018.05.25

이 아파트에 거주를 하려면 조건이 있는데, “a 층의 b 호에 살려면 자신의 아래(a-1)층에 1호부터 b 호까지 사람들의 수의 합만큼 사람들을 데려와 살아야한다” 는 계약 조항을 꼭 지키고 들어와야 한다.

아파트에 비어있는 집은 없고 모든 거주민들이 이 계약 조건을 지키고 왔다고 가정 했을 때, 주어지는 양의 정수 k와 n에 대해 k층에 n호에는 몇 명이 살고 있나를 출력하라. 단, 아파트에는 0층부터 있고 각층에는 1호부터 있으며, 0층에 i호에는 i명이 산다.



2
1
3
2
3

2개 케이스

1층 3호

2층 3호


6
10



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*;
 
 
public class Main {
    
    
    
    public static void main(String[] args) {
    
        
        
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine().trim();
        int countTry = Integer.valueOf(input);
        String disInput = "";
        int bSum=0;
        int count=1;
        String output="";
        int[][] arr = new int[15][15];
        
        for(int i=0; i<15 ; i++) {
            arr[0][i] = i+1;
            arr[i][0] = 1;
        }
        
        
        for(int k=0  ; k <countTry ; k++) {
            disInput = sc.nextLine().trim();
            int a = Integer.parseInt(disInput);
            disInput = sc.nextLine().trim();
            int b = Integer.parseInt(disInput);
            
            for(int i=1; i<=a ; i++) {
                
                for(int j=1; j<=b; j++) {
                    
                    arr[i][j]= arr[i][j-1] + arr[i-1][j]; 
                    
                }
                
            }
            
            System.out.println(arr[a][b-1]);
            
        }
        
    }
    
}


'오락기 > codeWar' 카테고리의 다른 글

백준 1924 2007년  (0) 2018.05.25
백준 10250 acm호텔  (0) 2018.05.25
백준 8721267 벌집  (0) 2018.05.25
백준 2438 별찍기  (0) 2018.05.25
백준 2941 크로아티아 알파벳  (0) 2018.05.25

오늘은 2007년 1월 1일 월요일이다. 그렇다면 2007년 x월 y일은 무슨 요일일까? 이를 알아내는 프로그램을 작성하시오.



첫째 줄에 x월 y일이 무슨 요일인지에 따라 SUN, MON, TUE, WED, THU, FRI, SAT중 하나를 출력한다.


1 1



MON

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.*;
 
public class Main{
 
    public static void main(String args[]){
        
        int[] cal =        { 31,  28  ,31 , 30 , 31,    30,  31,  31,  30,  31,  30,  31} ;
        String[] cal2 = { "SUN"  , "MON""TUE""WED""THU""FRI""SAT" };
        
        Scanner sc = new Scanner(System.in);
        
        int t = 0;
        int m = sc.nextInt();
        int d = sc.nextInt();
        
        
        
        for(int i = 0 ; i< m-1 ; i++){
                        
            t +=cal[i];
//            System.out.println(cal[i]);
            
        }
//        System.out.println(t);
//        System.out.println(d);
//        System.out.println();
        t=t+d;
        t=t%7;
        
//        System.out.println(t);
        System.out.println(cal2[t]);
        
    
 
    }
}


'오락기 > codeWar' 카테고리의 다른 글

백준 2755 부녀회장이 될테야  (0) 2018.05.25
백준 10250 acm호텔  (0) 2018.05.25
백준 8721267 벌집  (0) 2018.05.25
백준 2438 별찍기  (0) 2018.05.25
백준 2941 크로아티아 알파벳  (0) 2018.05.25


엘베가 젤 왼쪽

손님들은 1호부터 배정받아야하고

층수가 낮은것부터 채워나간다


테스트 케이스 와 h w n->방번호 를입력 하면 몇호인지 출력


2
6 12 10
30 50 72



402
1203


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
 
 
public class Main {
    
    
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine().trim();
        int countTry = Integer.valueOf(input);
        String disInput = "";
        int h=0;
        int w=0;
        int num=0;
        int count=1;
        String output="";
        for(int i=0  ; i <countTry ; i++) {
            
            disInput = sc.nextLine().trim();
            int a = disInput.indexOf(" ");
            int b = disInput.lastIndexOf(" ");
            h = Integer.parseInt(disInput.substring(0, a));
            w = Integer.parseInt(disInput.substring(a+1, b));
            num = Integer.parseInt(disInput.substring(b+1, disInput.length()));
                
            while(num>h) {
                num=num-h;
                count++;
            }
            
            output = num+"";
            
            if(count < 10) {
                output +="0"+count;
            }else {
                output +=count;
            }
            
            System.out.println(output.trim());
            count=1;
        }
    }
    
}
 


'오락기 > codeWar' 카테고리의 다른 글

백준 2755 부녀회장이 될테야  (0) 2018.05.25
백준 1924 2007년  (0) 2018.05.25
백준 8721267 벌집  (0) 2018.05.25
백준 2438 별찍기  (0) 2018.05.25
백준 2941 크로아티아 알파벳  (0) 2018.05.25


일때 방을 지난갯수 표현 13까지는 3개 28까지는 5개



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.*;
 
 
public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine().trim();
        
        int a = Integer.valueOf(input);
        int count = 0;
        int com = 1;
//         Math.pow(6, complux);
//        7이하 +1
//        19이하 +2
//        37이하+3
//        61이하 +4
//        각 숫자 차이는 6 , 12 , 18 , 24 순으로 증가 
        
 
        while(true) {
//            System.out.println(com +" 까지  a값은 -> " +a);
            if( a <=  (6*count) + com) {
                break;
            }
            com = (6*count) + com;
            count++;
            
        }
        
        System.out.println(count+1);
        
        
    }
    
        
}
 


'오락기 > codeWar' 카테고리의 다른 글

백준 1924 2007년  (0) 2018.05.25
백준 10250 acm호텔  (0) 2018.05.25
백준 2438 별찍기  (0) 2018.05.25
백준 2941 크로아티아 알파벳  (0) 2018.05.25
백준 5622 다이얼  (0) 2018.05.25

첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제


5
*
**
***
****
*****

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.*;
 
public class Main{
 
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        
        for(int i = 1 ; i <= t ; i ++){
            
            for(int  j = 0 ; j<i ; j++){
                System.out.print("*");
            }
 
            System.out.println();
        }
    }
}


'오락기 > codeWar' 카테고리의 다른 글

백준 10250 acm호텔  (0) 2018.05.25
백준 8721267 벌집  (0) 2018.05.25
백준 2941 크로아티아 알파벳  (0) 2018.05.25
백준 5622 다이얼  (0) 2018.05.25
백준 2908 상수  (0) 2018.05.25
크로아티아 알파벳변경
čc=
ćc-
dz=
ñd-
ljlj
njnj
šs=
žz=

이고 위에 없는 알파벳은 한글자씩 샌다




ljes=njak
6
ddz=z=
3



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.util.*;
 
public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine().trim();
        String str = input;
//        String str = "nljj";
        int count = str.length();
//        dz
//        lj
//        nj
        
        for(int i=0 ; i<str.length() ; i++) {
            
//            System.out.println(str.charAt(i));
            
            if(str.charAt(i) == '=' || str.charAt(i) == '-') {
                count--;
//                System.out.println("= -  빼기");
            }
            
             
            if( (str.charAt(i) == 'd' && str.length() - i >= 3)  && str.charAt(i+1) == 'z' && str.charAt(i+2)  == '=') {
                count--;
                count--;
                i++;
                i++;
//                System.out.println("dz");
            }
            
            if((str.charAt(i) == 'l' && str.length() - i >= 2) && str.charAt(i+1) == 'j') {
                count--;
                i++;
//                System.out.println("lj");
            }
            if((str.charAt(i) == 'n' && str.length() - i >= 2) && str.charAt(i+1) == 'j') {
                count--;
                i++;
//                System.out.println("nj");
            }
            
            
        }
        System.out.println(count);
        
        
        
    }
    
        
}
 

'오락기 > codeWar' 카테고리의 다른 글

백준 8721267 벌집  (0) 2018.05.25
백준 2438 별찍기  (0) 2018.05.25
백준 5622 다이얼  (0) 2018.05.25
백준 2908 상수  (0) 2018.05.25
백준 1157 단어공부  (0) 2018.05.25

+ Recent posts