오늘은 역량평가 2일째 입니다~람쥐~

아,., 근데 시망... 망했다 망했어 ㅋㅋㅋ

신입은 3문제인데 죄다 어렵네 ㅋㅋㅋ

첫번째 문제 풀다가 망해서 세번째 문제 ㅋㅋㅋ

세번째 문제도 풀다가 어려워서 다시 첫번째 문제 ㅋㅋㅋ

결국 이렇게 옮겨 다니다가 망햇다 ㅋㅋㅋ

암껏도 하지도 못했어 ㅋㅋ

첫번째 시간 초과 ㅋㅋㅋㅋ

세번째 페일...... 드랍드랍 ㅠㅠ

망했다 ㅋㅋㅋ 이제 단기 제대로 맘 잡고 해야지 ㅋㅋㅋ

안드로이드 바로 시작이다 고고싱 ㅋㅋㅋㅋ

'일기' 카테고리의 다른 글

시작 발표를 마치고...  (1) 2012.02.28
단기 컨택의 하루  (1) 2012.02.26
집중세미나를 마지막으로..  (3) 2012.02.25


자료구조 링크드 리스트....

진짜 링크드 리스트 하기 싫었는데 결국 했습니다....

하.....

<<소스코드>>
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>

struct List
{
 int data;
 struct List* next;
}LIST;

typedef struct List*  PLIST;

void Add ( PLIST plist );
void Delete();
void show();

PLIST head=NULL, tail=NULL;

void main()
{
 int select;
 PLIST plist;
 while(1)
 {
  printf("SELECT!!\n");
  printf("1. Intsert\n");
  printf("2. Delete\n");
  printf("3. Show\n");
  printf("4. Exit\n");

  printf("입력 : ");
  scanf("%d",&select);
  plist=(PLIST)malloc(sizeof(LIST));
  switch(select)
  {
  case 1:
   Add(plist);
   break;
  case 2:
   Delete();
   break;
  case 3:
   show();
   break;
  case 4:
   exit(0);
  }
 }
 free(plist);
}
void Add ( PLIST plist )
{
 int num;
 printf("넣을값:");
 scanf("%d",&num);

 plist->next=NULL;
 plist->data=num;

 if(head==NULL)// head가 NULL일때,
 {
  head=tail=plist;
 }
 else
 {
  tail->next=plist;
  tail=plist;
 }
}
void show()
{
 PLIST plist=head;
 while(plist)
 {
  printf("%d\n",plist->data);
  plist=plist->next;
 }
}
void Delete()
{
 int num;
 PLIST plist=head->next;
 tail=head;
 
 printf("삭제할값:");
 scanf("%d",&num);

 while(plist!=NULL)
 {
  if(plist->data==num)
  {
   tail->next=plist->next;
   return ;
  }
  else
  {
   tail=tail->next;
   plist=plist->next;
  }
 }
}

'IT 공부 > 자료구조' 카테고리의 다른 글

SRTF  (2) 2012.02.28
SSTF Scheduling  (0) 2012.02.28
FCFS  (2) 2012.02.25
SRTF 스케줄링  (0) 2012.02.25


문제는 두수 a,b를 입력해서 a와b 사이에 숫자를 호수일경우 3n+1을하고 짝수일 경우 n/2를 한다.
그래서 가장 큰 수를 뽑아내는 알고리즘이다.

<<<소스>>>
#include<stdio.h>
#include<stdlib.h>

void main()
{
 int i;
 int one,two;
 int max=0;
 int count=0;
 int n=0;

 printf("첫번째 : ");
 scanf("%d",&one);

 printf("두번째 : ");
 scanf("%d",&two);

 for(i=one;i<two;i++)
 {
  max=i;
  count=0;
  while(1)
  {   
   if(max==1)
   {
    break;
   }
   else if(max%2==0)//짝수
   {
    max/=2;
   }
   else//홀수
   {
    max=3*max+1;
   } 
   count++; 
  // printf("%d : %d\n",count,max);
  }  
  if(n<=count)
  {
   n=count;
  }
  
  printf("%d : %d\n",i,n);
 }
 printf("최대 횟수 : %d\n",n);
 scanf("%d",max);
}


타이틀바 없애기
requestWindowFeature(Window.FEATURE_NO_TITLE);
인디케이터 없애기
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

'IT 공부 > 안드로이드' 카테고리의 다른 글

XML을 활용한 RSS리더기  (1) 2012.02.25
파서(Get)  (1) 2012.02.25
Animation effect  (1) 2011.11.03
화면 변화  (1) 2011.11.02
자유곡선  (2) 2011.11.02
애니메이션 효과는 크게 2가지 있다.
1. Tweended animation : 뷰를 회전, 크기변경, 투명조절등의 에니메이션 방법
2. Frame-by-frame-animation :  연속된 이미지를 표시하는 에니메이션 방법

ALPHA = fromAlpha toAlpha – 0에서 1사이의 부동 소수

SCALE = fromXScale/toXScale - 0에서 1사이의 부동 소수

fromYScale/toYScale - 0에서 1사이의 부동 소수

pivotX/pivotY – 그림의 폭/높이는 0%에서 100%사이의 백분율로 나타낸 문자열

TRANSLATE = fromX/fromY - 0에서 1사이의 부동 소수

toX/toY - 0에서 1사이의 부동 소수

ROTATE = fromDegrees/toDegrees – 0에서 360 사이의 부동 소수

AnimationSet은 여러 animation을 쓰고자 할떄 쓴다.

ex)
public static void setLayoutAnim_slidedownfromtop(ViewGroup panel,int a) {

       AnimationSet set = new AnimationSet(true);

       Animation animation = new AlphaAnimation(0.0f, 1.0f);
       animation.setDuration(1000);
       set.addAnimation(animation);
      
       if(a==1){
       animation = new TranslateAnimation(
           Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
           Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f
       );
       }
       else{
        animation = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
            );
       }
       animation.setDuration(1000);
       set.addAnimation(animation);
       /*
       ScaleAnimation scale = new ScaleAnimation(-1, 1, -1, 1,
         ScaleAnimation.RELATIVE_TO_SELF, 1f,
         ScaleAnimation.RELATIVE_TO_SELF, 1f);
       set.addAnimation(scale);
       */
       panel.startAnimation(set);
    }

'IT 공부 > 안드로이드' 카테고리의 다른 글

파서(Get)  (1) 2012.02.25
Activity 화면창  (3) 2011.11.03
화면 변화  (1) 2011.11.02
자유곡선  (2) 2011.11.02
단어 정리  (2) 2011.08.12

화면 가로 고정
android:screenOrientation="landscape"
화면 세로 고정
android:screenOrientation="portrait"
폰 설정에 따라 변화
android:screenOrientation="unspecified"

'IT 공부 > 안드로이드' 카테고리의 다른 글

파서(Get)  (1) 2012.02.25
Activity 화면창  (3) 2011.11.03
Animation effect  (1) 2011.11.03
자유곡선  (2) 2011.11.02
단어 정리  (2) 2011.08.12

public class DrawingActivity extends Activity{

 LinearLayout drawArea;
 LinearLayout buttonList;
 Button MenuOpenButton;
 Button MenuCloseButton;
 private Paint mPaint;

 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(new MyView(this));
     mPaint = new Paint();  
         mPaint.setColor(Color.BLACK);   //색
         mPaint.setAntiAlias(true);   //테두리 부르럽게
         mPaint.setStyle(Paint.Style.STROKE);
         mPaint.setStrokeJoin(Paint.Join.ROUND);
         mPaint.setStrokeCap(Paint.Cap.ROUND);
         mPaint.setStrokeWidth(12);
 }
 
 public class drawPaint{
  private float x;
  private float y;
  private boolean draw;
  
  public drawPaint(float x,float y,boolean d){
   this.x=x;
   this.y=y;
   draw=d;
  }
  public boolean getDraw(){
   return draw;
  }
  public void setDraw(boolean _draw){draw=_draw;}
  public float getX(){return x;}
  public float getY(){return y;}
 }
 public class MyView extends View {   
    
     private Bitmap mBitmap;
     private Canvas mCanvas;
     private Path mPath;
     private Paint mBitmapPaint;
        

     public MyView(Context context) {  
         super(context);  
      
         DisplayMetrics metrics=new DisplayMetrics();
         getWindowManager().getDefaultDisplay().getMetrics(metrics);
         mBitmap=Bitmap.createBitmap(metrics.widthPixels,metrics.heightPixels,Bitmap.Config.ARGB_8888);
        
         mCanvas = new Canvas(mBitmap);
         mPath=new Path();
         mBitmapPaint=new Paint(Paint.DITHER_FLAG);
         mCanvas.drawColor(0xFFFFFFFF);
        
        
     }  
       
     protected void onDraw(Canvas canvas) {  
         canvas.drawColor(0xFF000000);   //배경색
         canvas.drawBitmap(mBitmap, 0,0,mBitmapPaint);
         canvas.drawPath(mPath, mPaint);
     }  
  
    
     private float mX,mY;
     private static final float TOUCH_TOLERANCE=4;
    
     private void touch_start(float x,float y){
      mPath.reset();
      mPath.moveTo(x, y);
      mX=x;
      mY=y;
     }
    
     private void touch_move(float x,float y){
      float dx=Math.abs(x-mX);
      float dy=Math.abs(y-mY);
      if(dx>=TOUCH_TOLERANCE || dy>=TOUCH_TOLERANCE){
       mPath.quadTo(mX, mY, (x+mX)/2,(y+mY)/2);
       mX=x;
       mY=y;
      }
     }
    
     private void touch_up(){
      mPath.lineTo(mX, mY);
      mCanvas.drawPath(mPath, mPaint);
      mPath.reset();
     }  
    
     public boolean onTouchEvent(MotionEvent event) {  
      float x=event.getX();
      float y=event.getY();
         switch (event.getAction()) {  
         case MotionEvent.ACTION_DOWN:   //눌렀을떄
            touch_start(x,y);
             break;  
         case MotionEvent.ACTION_MOVE:   //움직였을떄
            touch_move(x,y);
             break;
         case MotionEvent.ACTION_UP:
          touch_up();
          break;
         }  
         invalidate();
         return true;  
     }  
  
 } 

}

자유 곡선 예제 입니다...........
어렵다우.ㅜㅜ

'IT 공부 > 안드로이드' 카테고리의 다른 글

파서(Get)  (1) 2012.02.25
Activity 화면창  (3) 2011.11.03
Animation effect  (1) 2011.11.03
화면 변화  (1) 2011.11.02
단어 정리  (2) 2011.08.12


Layout
1. FramLayout 간단한 레이아웃,  뷰,컨트롤들을 왼쪽 꼭대기에 겹쳐서 차곡차곡 쌓아 놓는다.
2. LinearLayout 내부의 요소들을 횡이나 종으로 나열한다.
3. RelativeLayout 특정 내부요소를 다른 내부요소에 관련되어 쓸수있게한다.
4. TableLaout 열,횡의 테이블 모양을 이용할때 쓴다.
5. AbsoluteLayout 각각 내부 요소들의 위치가 좌표로 주어진다.

Cursor 간략히 말하면 위치를 나타내는 것이다. Adapter로 부터 받은자료의 위치를 나타낸다.
Adapter 자료와 자료를 연결해주는 역활을 한다.

매니페스트 - 어플리케이션의 정보를 가지고 있다.
uses-permission - 어플리케이션에 권한을 부여한다.
Bundle(savedInstanceState) - 셧다운된후 엑티비티가 다시 초기화하는 경우 가장 최근에 공급된 데이터를 메소드에 포함
.rawQuery - 자료 검색을 한다. return cursor;

'IT 공부 > 안드로이드' 카테고리의 다른 글

파서(Get)  (1) 2012.02.25
Activity 화면창  (3) 2011.11.03
Animation effect  (1) 2011.11.03
화면 변화  (1) 2011.11.02
자유곡선  (2) 2011.11.02

+ Recent posts