top of page
게시판 게시물
sooho0506
2022년 6월 26일
In 소스 코드 제출
#include <stdio.h> #include <string.h> char a[100],c[20][111] = {"push","top","pop","size","empty"},s='('; int n,i,o,j,p=0,y=0,top=0,str[100],k=0,aa[100]; void play() { switch (k) case 0: str[top]=aa; top++; case 1: if(str[top-1]==0) { pirntf("-1"); } else { printf("%d",str[top-1]); } case 2: str[top-1]=o; top--; case 3: pirntf("%d",top-1); case 4: if(str[0]==0) { printf("false"); } else { printf("true"); } } int main() { scanf("%d ",&n); for(i=0; i<n; i++) { gets(a); //printf("%c",a[7]); aa[1]=a[6]; for(i=0; i<n; i++) { y=0; for(o=0; o<5; o++) { if(y==0) { for(j=0; j<=strlen(a); j++) { if(a[j]==c[o][j]) { p++; } } if(p==strlen(c[o])) { k=o; play(); } } } } } }
0
0
2
sooho0506
2022년 6월 19일
In 소스 코드 제출
#include <stdio.h> #include <string.h> char k[100],a[100][100],aa,c[20][111] = {"push","top","pop","size","empty"},s='('; int n,i,o,j,p,y=0,top=1,stack[100]; void play (int i, char aa) { switch (i) { case 0: k=push(aa); } } void push(char aa) { stack[top]=aa; } int main() { scanf("%d",&n); for(i=0; i<n; i++) { gets(a[i]); aa=a[7]; y=0; for(o=0; o<5; o++) { if(y==0) { p=strcmp(a[i],c[o]); if(p==0) { play(i,aa); } } } } }
0
0
3
sooho0506
2022년 6월 12일
In 소스 코드 제출
int n,top=1,i,o,u,h=0,y=0,p=0,q[100]; /* #include <stdio.h> #include <stdlib.h> int main() { int n,i,u=5; scanf("%d",&n); for(i=2;i<=n;i++) { u=u+i*3+1; } printf("%d",u); } */ #include <stdio.h> #include <string.h> char b[200][100],d[100][100],c[20][111] = {"push","top","pop","size","empty"}; int n,top=1,i,o,u,h=0,y=0,p=0,q[100]; char push(char c[]) { q[top]=c[i]; return p; } int main() { for(i=0; i<n; i++) { gets(b[i]); for(o=0; o<=strlen(b[i]); o++) { if(y==0) { d[i][o]=b[i][o]; if(b[i][o+1]=='(') { h=o; y=1; } } } y=0; for(i=0;i<5;i++) { for(o=0;o<strlen(c[i]);o++) { if(d[i][o]==c[i][o]) { p++; } } if(p==strlen(c[i])) { switch (i) { case 0: push(c[i]); break; case 1: //top(); break; case 2: //pop(); break; case 3: //size(); break; case 4: //empty(); break; } } } } }
0
0
4
sooho0506
2022년 5월 15일
In 소스 코드 제출
/* #include <stdio.h> int main() { int i,o=0,top=0,p=0,q; char d[222222],a[1000],b[244][50]= {"Paint.Picture","Word.Document.8","Word.Document.12","htmfile","htmfile","Hwp.Document.96","Hwp.Document.hwpx.96","Hwp.Document.hwt.96","jpegfile","jpegfile","jpegfile","PowerPoint.Show.8","PowerPoint.Show.12","powerpointxmlfile"}; char c[22][20]= {".did",".doc",".docx",".htm",".html",".hwp",".hwpx",".hwt",".jpe",".jpeg",".jpg",".ppt",".pptx",".pptxml"}; scanf("%s",a); for(i=0; i<=strlen(a)-1; i++) { if(a[i]=='.') { o=1; } if(o==1) { d[top]=a[i]; top++; } } o=0; for(i=13; i>=0; i--) { for(o=0; o<strlen(d); o++) { if(d[o]==c[i][o]) { p++; } { if(p==strlen(c[i])) { for(q=0; b[i][q]!=0 ; q++) { printf("%c",b[i][q]); } return 0; } } } p=0; } } #include <stdio.h> */ /* #include <stdio.h> int main() { int i,o,b[10],c[10]; double a=3000,d=3000; for(i=0; i<3; i++) { scanf("%d",&b[i]); if(b[i]<a) { a=b[i]; } } for(o=0; o<2; o++) { scanf("%d",&c[o]); if(d>c[o]) { d=c[o]; } } a=(a+d)/100*110; printf("%.1f",a); } */ #include<stdio.h> int main() { int a,i,b[100000]={1,1,1},c=1,top=2,d; scanf("%d",&a); for(i=0;i<a;i++) { d=b[top]; b[top+1]=(b[c+d-1])+(b[top-d+1]); top++; } printf("%d",b[a]); } \
0
0
1
sooho0506
2022년 5월 08일
In 소스 코드 제출
#include <stdio.h> int main() { int i,o=0,top=0,p=0,q; char d[222222],a[1000],b[244][50]= {"Paint.Picture","Word.Document.8","word.Document.12","htmfile","htmfile","Hwp.Document.96","Hwp.Document.hwpx.96","Hwp.Document.hwt.96","jpegfile","jpegfile","jpegfile","PowerPoint.Show.8","PowerPoint.Show.12","powerpointxmlfile"}; char c[22][20]= {".did",".doc",".docx",".htm",".html",".hwp",".hwpx",".hwt",".jpe",".jpeg",".jpg",".ppt",".pptx",".pptxml"}; scanf("%s",a); for(i=0; i<=strlen(a)-1; i++) { if(a[i]=='.') { o=1; } if(o==1) { d[top]=a[i]; top++; } } o=0; //printf("%d ",strlen(c[13])); for(i=13; i>=0; i--) { for(o=0; o<=strlen(d); o++) { if(d[o]==c[i][o]) { p++; } { if(p==strlen(c[i])) { for(q=0; q<=strlen(b[i]); q++) { printf("%c",b[i][q]); } return 0; } } } p=0; } } a
0
0
1
sooho0506
2022년 5월 01일
In 소스 코드 제출
/* #include <stdio.h> #include <stdlib.h> char a[1000000],b[10000000]; int main() { int i,c,top=0; scanf("%s", a); for(i=0;a[i]!='\0';i++) { c=i; } for(i=c;i>=0;i--) { b[top]=a[i]; top++; } for(i=0;i<=c;i++) { printf("%c",b[i]); } return 0; } */ /* #include <stdio.h> int main() { int top=0,i,o,y,p,v; char a[105][105] = {0},b[1000][1000]; scanf("%d",&y); for(i=0;i<y;i++) { scanf("%s", a[i]); } for(i=0;i<y;i++) { for(p=0;a[i][p]!='\0';p++) { v=p; } for(o=v;o>=0;o--) { b[i][top]=a[i][o]; top++; } for(p=0;p<=v;p++) { printf("%c",b[i][p]); } printf("\n"); top=0; } } */ #include <stdio.h> int main() { int i,o=0,top=0; char d[222222],a[1000],b[22][50]={"Paint.Picture","Word.Document.8","word.Document.12","htmfile","htmfile","Hwp.Document.96","Hwp.Document.hwpx.96","Hwp.Document.hwt.96","jpegfile","jpegfile","jpegfile","PowerPoint.Show.8","Powerpoint.Show.12","powerpointxmlfile"}; char c[22][20]={".did",".doc",".docx",".htm",".html",".hwp",".hwpx",".hwt",".jpe",".jpeg",".jpg",".ppt",".pptx",".pptxml"}; scanf("%s",a); for(i=0;i<=strlen(a)-1;i++) { if(a[i]=='.') { } if(o==1) { } } } `1e
0
0
2
sooho0506
2022년 4월 24일
In 소스 코드 제출
/* #include <stdio.h> #include <stdlib.h > char stack[100000]; int main() { char number[10000] = {0}; int a,i,o=1,b,c=1,d=1,top=1; scanf("%d",&a); scanf("%s", number); // number[0] ~ number[a-1] for(i=a-1;i>=0;i--) { if(c==4) { stack[top]=','; c=1; top++; } stack[top]=number[i]; top++; c++; } for(i=top-1;i>=1;i--) { printf("%c",stack[i]); } printf("\n"); return 0; } */ #include <stdio.h> #include <stdlib.h> char a[1000000],b[10000000]; int main() { int i,c,top=0; scanf("%s", a); for(i=0;a[i]!='\0';i++) { c=i-1; } for(i=c;i>=0;i--) { a[i]=b[top]; top++; } for(i=0;i<=c;i++) { printf("%c",b[i]); } return 0; }
0
0
2
sooho0506
2022년 4월 24일
In 소스 코드 제출
#include <stdio.h> #include <stdlib.h> char stack[100000]; int main() { char number[10000] = {0}; int a,i,o=1,b,c=1,d=1,top=1; scanf("%d",&a); scanf("%s", number); // number[0] ~ number[a-1] for(i=a-1;i>=0;i--) { if(c==4) { stack[top]=','; c=1; top++; } stack[top]=number[i]; top++; c++; } for(i=top-1;i>=1;i--) { printf("%c",stack[i]); } printf("\n"); return 0; }
0
0
1
sooho0506
2022년 4월 17일
In 소스 코드 제출
/* #include <stdio.h> #include <stdlib.h> int main() { int a,k[100001]={0},i,e,b=1,h=0; scanf("%d",&a); for(i=1;i<=a;i++) { scanf("%d",&e); if(e==0) { b--; k[b]=0; } else { k[b]=e; b++; } } for(i=1;i<=a;i++) { h=h+k[i]; } printf("%d",h); } */ /* #include<stdio.h> #define MAXSIZE 5 // First In, Last Out int stack[MAXSIZE] = {0}, top = 0; void input(int k) { if(top==MAXSIZE) { printf("Stack is FULL\n"); return ; } stack[top] = k; top++; } void output() { if(top==0) { printf("STack is Empty\n"); return ; } top--; printf("output data is %d\n", stack[top]); stack[top] = 0; } void show() { for(int i=MAXSIZE-1; i>=0; i--) { printf("%d: %d\n", i, stack[i]); } } int main() { int n, k; for(;;) { printf("1: input, 2:output, 3:view, 4~: error\n"); scanf("%d", &n); switch(n) { case 1: printf("input value: "); scanf("%d", &k); input(k); break; case 2: output(); break; case 3: show(); break; default: printf("input error\n"); } } } */ #include<stdio.h> #define MAXSIZE 5 int stack[MAXSIZE] ={0},top=0; void input(int k) { if(top==MAXSIZE) { printf("STACK IS FULL\n"); return ; } stack[top]=k; top++; } void output() { top--; printf("output data is %d\n",stack[top]); stack[top]=0; } void show() { for(int i=MAXSIZE;i>=0;i--) { printf("%d:%d\n",i,stack[i]); } } int main() { int a,k; for(;;) { printf("1:input 2:output 3:show 4: ettor \n"); scanf("%d",&a); switch (a) { case 1: printf("input value "); scanf("%d",&a); input(k); break; case 2: output(); break; case 3: show(); break; } } }
0
0
1
sooho0506
2022년 4월 17일
In 소스 코드 제출
#include <stdio.h> #include <stdlib.h> int main() { int a,k[100001]={0},i,e,b=1,h=0; scanf("%d",&a); for(i=1;i<=a;i++) { scanf("%d",&e); if(e==0) { b--; k[b]=0; } else { k[b]=e; b++; } } for(i=1;i<=a;i++) { h=h+k[i]; } printf("%d",h); }
0
0
1
sooho0506
2022년 4월 10일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #include<conio.h> void gotoxy(int x,int y) { COORD pos = {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(unsigned short text,unsigned short back) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),text|(back<<4)); } int main() { int la,lb,l=0,i,o,map[101][101],p[9]= {0,4,4,4,4,0,0,0,0},t,w,ll,u=0; srand (time(0)); for(i=1; i<=20; i++) { for(o=1; o<=10; o++) { gotoxy(i+40,o+5); if(i%4!=0&&o%5!=0||i<4) { printf(" "); map[i][o]=0; } if(i%4==0) { printf("|"); map[i][o]=9; } if(o%5==0) { printf("*"); map[i][o]=9; } } } for(i=2; i<=5; i++) { for(o=1; o<=4; o++) { gotoxy((i*4-3)+40,o+5); setColor(o,o); map[i*4-2][o]=o; printf(" %d ",o); } } setColor(2,0); gotoxy(0,3); for(o=1; o<=10; o++) { for(i=1; i<=20; i++) { if(map[i][o]>0&&map[i][o]<5) { setColor(map[i][o],0); printf("%d",map[i][o]); } else { setColor(2,0); printf("%d",map[i][o]); } } printf("\n"); } for(;;) { gotoxy(40,20); printf(" "); gotoxy(40,20); printf("기존유리병 ="); scanf("%d",&la); gotoxy(55,20); printf("옮길 유리병 ="); scanf("%d",&lb); setColor(2,0); gotoxy(1,1); if(p[lb]<4&&p[la]>0) { p[lb]++; if(la>4) { la=la-4; u=1; } else { u=0; } if(u==1) { gotoxy((la*4-3)+44,15-p[la+4]); l=map[la*4-2+4][10-p[la+4]]; map[la*4-2+4][10-p[la+4]]=0; p[la+4]--; } else { gotoxy((la*4-3)+44,10-p[la]); l=map[la*4-2+4][5-p[la]]; map[la*4-2][5-p[la]]=0; p[la]--; } printf(" "); if(lb>4) { lb=lb-4; gotoxy((lb*4-3)+44,15-p[lb+4]); map[lb*4-2+4][10-p[lb+4]]=l; setColor(l,l); } else { gotoxy((lb*4-3)+44,10-p[lb]); map[lb*4-2+4][5-p[lb]]=l; setColor(l,l); } printf("eee"); setColor(2,0); printf("[%d]",p[la]); gotoxy(0,3); for(o=1; o<=10; o++) { for(i=1; i<=20; i++) { if(map[i][o]>0&&map[i][o]<5) { setColor(map[i][o],0); } else { setColor(2,0); } printf("%d",map[i][o]); } printf("\n"); } } la=0; lb=0; for(i=1; i<=8; i++) { for(o=1; o<=3; o++) { { if(i>4) { // i=i-4; if(map[(i-4)*4-2+4][10-o]==map[(i-4)*4-2+4][10-(o+1)]&&map[(i-4)*4-2+4][10-o]!=0) { la++; } } else { if(map[i*4-2+4][5-o]==map[i*4-2+4][5-(o+1)]&&map[i*4-2+4][5-o]!=0) { la++; } } } } if(la==3) { lb=lb+1; } la=0; } if(lb==4) { printf("얼미ㅡㅓㄷ리ㅏ너리"); }printf("la:%d lb:%d\n", la, lb); } return 0; }
0
0
1
sooho0506
2022년 4월 03일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #include<conio.h> void gotoxy(int x,int y) { COORD pos = {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(unsigned short text,unsigned short back) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),text|(back<<4)); } int main() { int la,lb,l=0,i,o,map[101][101],p[9]= {0,4,4,4,4,1,1,1,1},t,w,ll,u=0; srand (time(0)); for(i=1; i<=20; i++) { for(o=1; o<=10; o++) { gotoxy(i+40,o+5); if(i%4!=0&&o%5!=0||i<4) { printf(" "); map[i][o]=0; } if(i%4==0) { printf("|"); map[i][o]=9; } if(o%5==0) { printf("*"); map[i][o]=9; } } } for(i=2; i<=5; i++) { for(o=1; o<=4; o++) { p[o-1]=4; gotoxy((i*4-3)+40,o+5); setColor(o,o); map[i*4-2][o]=o; printf(" %d ",o); } } setColor(2,0); gotoxy(0,3); for(o=1; o<=10; o++) { for(i=1; i<=20; i++) { if(map[i][o]>0&&map[i][o]<5) { setColor(map[i][o],map[i][o]); printf("%d",map[i][o]); } else { setColor(2,0); printf("%d",map[i][o]); } } printf("\n"); } for(;;) { gotoxy(40,20); printf(" "); gotoxy(40,20); printf("기존유리병 ="); scanf("%d",&la); gotoxy(55,20); printf("옮길 유리병 ="); scanf("%d",&lb); setColor(2,0); gotoxy(1,1); if(p[lb]<4&&p[la]>0) { if(la>4) { la=la-4; u=1; } else { u=0; } if(u==1) { gotoxy((la*4-3)+44,15-p[la+4]); l=map[la*4-2+4][10-p[la+4]]; map[la*4-2+4][10-p[la+4]]=0; } else { gotoxy((la*4-3)+44,10-p[la]); l=map[la*4-2+4][5-p[la]]; map[la*4-2][5-p[la]]=0; } printf(" "); p[la]--; if(lb>4) { lb=lb-4; gotoxy((lb*4-3)+44,15-p[lb+4]); map[lb*4-2+4][5-p[lb+4]]=l; } else { gotoxy((lb*4-3)+44,10-p[lb]); map[lb*4-2+4][5-p[lb]]=l; } setColor(l,l); printf("eee"); p[lb+4]++; setColor(2,0); printf("[%d]",l); } } return 0; }
0
0
2
sooho0506
2022년 3월 13일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #include<conio.h> void gotoxy(int x,int y) { COORD pos = {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(unsigned short text,unsigned short back) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),text|(back<<4)); } int main() { int la,lb,l,i,o,map[101][101],p[8]= {1,1,1,1,1,1,1,1,1},t,w,ll; srand (time(0)); for(i=1; i<=20; i++) { for(o=1; o<=10; o++) { gotoxy(i+40,o+5); if(i%4!=0&&o%5!=0||i<4) { printf(" "); map[i][o]=0; } if(i%4==0) { printf("|"); map[i][o]=9; } if(o%5==0) { printf("*"); map[i][o]=9; } } } for(i=2; i<=5; i++) { for(o=1; o<=4; o++) { p[o-1]=4; gotoxy((i*4-3)+40,o+5); setColor(o,o); map[i*4-2][o]=o; printf(" %d ",o); } } setColor(2,0); gotoxy(0,3); for(o=1; o<=10; o++) { for(i=1; i<=20; i++) { if(map[i][o]>0&&map[i][o]<5) { setColor(map[i][o],map[i][o]); printf("%d",map[i][o]); } else { setColor(2,0); printf("%d",map[i][o]); } } printf("\n"); } for(;;) { gotoxy(40,20); printf(" "); gotoxy(40,20); printf("기존유리병 ="); scanf("%d",&la); gotoxy(55,20); printf("옮길 유리병 ="); scanf("%d",&lb); setColor(2,0); gotoxy(0,0); for(i=0; i<=3; i++) { printf("%d",p[i]); } } return 0; }
0
0
2
sooho0506
2022년 3월 06일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 #define SPACE 32 void gotoxy(int x,int y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(int x) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x); } int main() { int i,o,map[101][101],mapb[101][101],la,lb,l=0,ll=0,j; gotoxy(40,18); setColor(2); printf("기존칸"); srand(time(NULL)); ///기둥 출력 for(i=0; i<=20; i++) { for(o=0; o<=4; o++) { gotoxy(i+50,o+10); if(i%4==0) { { setColor(2); printf("|"); } map[i][o]=9; } else { printf(" "); map[i][o]=8; } } } gotoxy(72,12); printf("정답지->"); ///정답지출력 for(i=0;i<=20;i++) { for(o=0;o<=4;o++) { gotoxy(i+80,o+10); if(i%4==0) { printf("|"); mapb[i][o]=9; } else { printf(" "); mapb[i][o]=8; } } } ///정답지 링 출력 for(i=0;i<=4;i++) { o=rand()%5+1; mapb[i*4-2][4]=o; gotoxy(o*4-2+80,4+10); setColor(1); printf("%d",i); } setColor(6); ///기존 링 출력 for(i=0; i<=4; i++) { gotoxy(52,14-i); map[2][4-i]=5-i; printf("%d",map[2][4-i]); } ///맵 출력 while(1) { ///기존칸 옮기는 칸 출력 setColor(2); gotoxy(49,18); printf(" "); gotoxy(55,18); printf("옮기는칸"); gotoxy(49,18); scanf("%d",&la); gotoxy(67,18); scanf("%d",&lb); ///옮기는 칸의 맨 위의링 출력 ll=0; for(i=0;i<=4;i++) { if(map[lb*4-2][i]!=8) { ll=map[lb*4-2][i]; } } ///기존칸의 맨위의 링 L에저장 & 링삭재 for(i=0; i<=4; i++) { if(map[la*4-2][i]!=8) { if(map[la*4-2][i]<=ll||ll==0 ) { gotoxy(la*4-2+50,i+10); printf(" "); l=map[la*4-2][i]; map[la*4-2][i]=8; break; } } } ///기존칸에 옮길 링이 있다면 옮기기 if(l>0) { for(i=4; i>=0; i--) { if(map[lb*4-2][i]==8) { gotoxy(lb*4-2+50,i+10); setColor(6); printf("%d",l); map[lb*4-2][i]=l; break; } } l=0; } ///map출력 for(i=0; i<=20; i++) { for(o=0; o<=4; o++) { gotoxy(i+15,o+5); if(map[i][o]==9) { setColor(8); printf("%d",map[i][o]); } if(map[i][o]==8) { setColor(7); printf("%d",map[i][o]); } if(map[i][o]!=8&&map[i][o]!=9) { setColor(6); printf("%d",map[i][o]); } } } gfgfgfgfgdty4ryf } ///정답을 완성했는지 확인 } gffg
0
0
2
sooho0506
2022년 2월 27일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 #define SPACE 32 void gotoxy(int x,int y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(int x) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x); } int main() { int i,o,map[101][101],mapb[101][101],la,lb,l=0,ll=0,j; gotoxy(40,18); printf("기존칸"); srand(time(NULL)); ///기둥 출력 for(i=0; i<=20; i++) { for(o=0; o<=4; o++) { gotoxy(i+50,o+10); if(i%4==0) { { printf("|"); } map[i][o]=9; } else { printf(" "); map[i][o]=0; } } } gotoxy(72,12); printf("정답지->"); ///정답지출력 for(i=0;i<=20;i++) { for(o=0;o<=4;o++) { gotoxy(i+80,o+10); if(i%4==0) { printf("|"); mapb[i][o]=9; } else { printf(" "); mapb[i][o]=0; } } } ///정답지 링 출력 for(i=0;i<=4;i++) { o=rand()%5+1; mapb[i*4-2][4]=o; gotoxy(o*4-2+80,4+10); printf("%d",i); } ///기존 링 출력 for(i=0; i<=4; i++) { gotoxy(52,14-i); map[2][4-i]=5-i; printf("%d",map[2][4-i]); } ///맵 출력 for(i=0; i<=20; i++) { for(o=1; o<=4; o++) { gotoxy(i+15,o); printf("%d",map[i][o]); } } while(1) { ///기존칸 옮기는 칸 출력 gotoxy(49,18); printf(" "); gotoxy(55,18); printf("옮기는칸"); gotoxy(49,18); scanf("%d",&la); gotoxy(67,18); scanf("%d",&lb); ///옮기는 칸의 맨 위의링 출력 for(i=0;i<=4;i++) { if(map[lb*4-2][i]!=0) { ll=map[lb*4-2][i]; } } ///기존칸의 맨위의 링 L에저장 & 링삭재 for(i=0; i<=4; i++) { if(map[la*4-2][i]!=0) { if(map[la*4-2][i]>=ll) { gotoxy(la*4-2+50,i+10); printf(" "); l=map[la*4-2][i]; map[la*4-2][i]=0; break; } } } ///기존칸에 옮길 링이 있다면 옮기기 if(l>0) { for(i=4; i>=0; i--) { if(map[lb*4-2][i]==0) { gotoxy(lb*4-2+50,i+10); printf("%d",l); map[lb*4-2][i]=l; break; } } l=0; } ///map출력 for(i=0; i<=20; i++) { for(o=0; o<=4; o++) { gotoxy(i+15,o); printf("%d",map[i][o]); } } } }
0
0
5
sooho0506
2022년 2월 20일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 #define SPACE 32 void gotoxy(int x,int y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(int x) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x); } int main() { int i,o,map[101][101],la,lb,l; gotoxy(40,18); printf("기존칸"); for(i=0; i<=20; i++) { for(o=0; o<=4; o++) { gotoxy(i+50,o+10); if(i%4==0) { { printf("|"); } map[i][o]=9; } else { if(o==5) { } printf(" "); map[i][o]=0; } } } for(i=1; i<=3; i++) { gotoxy(52,15-i); printf("%d",i); map[2][5-i]=i; } for(i=0; i<=20; i++) { for(o=1; o<=4; o++) { gotoxy(i+15,o); printf("%d",map[i][o]); } } while(1) { gotoxy(49,18); printf(" "); gotoxy(55,18); printf("옮기는칸"); gotoxy(49,18); scanf("%d",&la); gotoxy(67,18); scanf("%d",&lb); for(i=1;i<=5;i++) { if(map[la*4-2][i]!=0) { gotoxy(la*4-2+50,i+10); printf(" "); l=map[la*4-2][i]; break; } } for(i=4;i>=0;i--) { if(map[lb*4-2][i]==0) { gotoxy(lb*4-2+50,i+10); printf("%d",l); break; } } } }
0
0
6
sooho0506
2022년 2월 20일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 #define SPACE 32 int map[50][50] = {0}; void gotoxy(int x,int y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(int x) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x); } int main() { char x; int sx = 5, sy = 5, directX = 0, directY = 0,yju = 0,yjd = 0,a[101][2],b=4,i,o,rx,ry,ax=0,ay=0,u=0,sas=1,v=0,f=0,r=1,px=10,py=10,hp=3,pk=0,pdk=1,pd=0,sax,say,sa[3]={0,1,1}; srand(time(NULL)); //맵 만드는 과정 for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } //폭탄위치 설정 px=rand()%24+1; py=rand()%24+1; gotoxy(px,py); printf("$"); map[px][py]=3; //반복 while(1) { if(hp>0) { //3초마다다 한번씩 if(pk==30) { //십자모양 폭탄 출력과정 for(i=0; i<=2; i++) { if(map[px][py-1+i]==5) { gotoxy(px,py-1+i); printf("#"); } else { gotoxy(px,py-1+i); printf("$"); map[px][py-1+i]=3; } } for(i=0; i<=2; i++) { if(map[px-1+i][py]==5) { gotoxy(px-1+i,py); printf("#"); } else { gotoxy(px-1+i,py); printf("$"); map[px-1+i][py]=3; } } //폭탄터짐 신호 pdk=0; //카운트다운 준비 pk=0; } pk++; if(pdk==0) { //폭탄터짐 신호라면? //카운트 다운 pd++; } if(pd==10) {//1초가 지났다면? //다지우기 for(i=0; i<=2; i++) { gotoxy(px,py-1+i); printf(" "); map[px][py-1+i]=0; } for(i=0; i<=2; i++) { gotoxy(px-1+i,py); printf(" "); map[px-1+i][py]=0; } //또다른 폭탄 만들기 px=rand()%24+1; py=rand()%24+1; gotoxy(px,py); printf("$"); map[px][py]=3; //이제는 카운트 않하고 카운트는=0 pd=0; pdk=1; for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } } if(ax==1) { ax++; } if(v==0) { if(2>rand()%10) { rx=rand()%24+1; ry=rand()%24+1; gotoxy(rx,ry); printf("@"); map[rx][ry]=9; v=1; } } ax=rx; ay=ry; { gotoxy(sx,sy); printf(" "); sx += directX; sy += directY; gotoxy(sx,sy); printf("+"); if(r==0) { gotoxy(sx,sy); setColor(2); printf("!"); Sleep(2000); for(i=1; i<=100; i++) { for(o=1; o<=25; o++) { gotoxy(i,o); printf(" "); } } gotoxy(50,20); printf("남은몫슴 %d개",hp); Sleep(500); gotoxy(1,1); for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } sx=10; sy=10; hp--; r=1; } if(sas==0) { gotoxy(sax,say); printf(" "); sax=sx; say=sy; sas=1; } if(sa[2]==0) { gotoxy(sax,say); printf(" "); map[sax][say]=0; gotoxy(sax+sa[1],say); printf("*"); sax+=sa[1]; map[sax][say]=8; } if(kbhit()) { x = getch(); switch(x) { case LEFT: directX = -1; directY=0; break; case RIGHT: directX = 1; directY=0; break; case UP: directY=-1; directX=0; break; case DOWN: directY=1; directX=0; break; case SPACE: //오른쪽으로 가고있다면? sas=0; if(directX==1) {//sa[1]를 1 즉 오른쪽으로 한다 sa[1]=1; //sa[2]0으로 바꾼 이유는 x좌표를 움직여야 하기 때문이다 sa[2]=0; sa[3]=1; } //위와 같다 .... if(directX==-1) { sa[1] =-1; sa[2]=0; sa[3]=1; } if(directY==1) { sa[1] =1; sa[3]=0; sa[2]=1; } if(directY==-1) { sa[1]=-1; sa[3]=0; sa[2]=1; } } } if(map[sx+directX][sy+directY]==9) { map[rx][ry]=0; gotoxy(ax+directX,ay+directY); printf(" "); f++; v=0; } gotoxy(70,20); printf("먹은사과 %d",f); if(map[sx+directX][sy+directY]==5||map[sx+directX][sy+directY]==3) { r=0; } } Sleep(100); } else { gotoxy(sx,sy); setColor(2); printf("!"); Sleep(2000); for(i=1; i<=100; i++) { for(o=1; o<=25; o++) { gotoxy(i,o); printf(" "); } } gotoxy(50,20); printf("game over"); Sleep(500); gotoxy(1,1); break; } } }
0
0
1
sooho0506
2022년 2월 13일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 #define SPACE 32 int map[50][50] = {0}; void gotoxy(int x,int y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(int x) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x); } int main() { char x; int sx = 5, sy = 5, directX = 0, directY = 0,yju = 0,yjd = 0,a[101][2],b=4,i,o,rx,ry,ax=0,ay=0,u=0,v=0,f=0,r=1,px=10,py=10,hp=3,pk=0,pdk=1,pd=0,sax,say,sa[3]={0,1,1}; srand(time(NULL)); //맵 만드는 과정 for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } //폭탄위치 설정 px=rand()%24+1; py=rand()%24+1; gotoxy(px,py); printf("$"); map[px][py]=3; //반복 while(1) { if(hp>0) { //3초마다다 한번씩 if(pk==30) { //십자모양 폭탄 출력과정 for(i=0; i<=2; i++) { if(map[px][py-1+i]==5) { gotoxy(px,py-1+i); printf("#"); } else { gotoxy(px,py-1+i); printf("$"); map[px][py-1+i]=3; } } for(i=0; i<=2; i++) { if(map[px-1+i][py]==5) { gotoxy(px-1+i,py); printf("#"); } else { gotoxy(px-1+i,py); printf("$"); map[px-1+i][py]=3; } } //폭탄터짐 신호 pdk=0; //카운트다운 준비 pk=0; } pk++; if(pdk==0) { //폭탄터짐 신호라면? //카운트 다운 pd++; } if(pd==10) {//1초가 지났다면? //다지우기 for(i=0; i<=2; i++) { gotoxy(px,py-1+i); printf(" "); map[px][py-1+i]=0; } for(i=0; i<=2; i++) { gotoxy(px-1+i,py); printf(" "); map[px-1+i][py]=0; } //또다른 폭탄 만들기 px=rand()%24+1; py=rand()%24+1; gotoxy(px,py); printf("$"); map[px][py]=3; //이제는 카운트 않하고 카운트는=0 pd=0; pdk=1; for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } } if(ax==1) { ax++; } if(v==0) { if(2>rand()%10) { rx=rand()%24+1; ry=rand()%24+1; gotoxy(rx,ry); printf("@"); map[rx][ry]=9; v=1; } } ax=rx; ay=ry; { gotoxy(sx,sy); printf(" "); sx += directX; sy += directY; gotoxy(sx,sy); printf("+"); if(r==0) { gotoxy(sx,sy); setColor(2); printf("!"); Sleep(2000); for(i=1; i<=100; i++) { for(o=1; o<=25; o++) { gotoxy(i,o); printf(" "); } } gotoxy(50,20); printf("남은몫슴 %d개",hp); Sleep(500); gotoxy(1,1); for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } sx=10; sy=10; hp--; r=1; } sax=sx; say=sy; if(sa[2]==0) { gotoxy(sax,say); printf(" "); map[sax][say]=0; gotoxy(sax+sa[2],say); printf("*"); sax+=sa[1]; map[sax][say]=8; } if(kbhit()) { x = getch(); switch(x) { case LEFT: directX = -1; directY=0; break; case RIGHT: directX = 1; directY=0; break; case UP: directY=-1; directX=0; break; case DOWN: directY=1; directX=0; break; case SPACE: //오른쪽으로 가고있다면? if(directX==1) {//sa[1]를 1 즉 오른쪽으로 한다 sa[1]=1; //sa[2]0으로 바꾼 이유는 x좌표를 움직여야 하기 때문이다 sa[2]=0; sa[3]=1; } //위와 같다 .... if(directX==-1) { sa[1] =-1; sa[2]=0; sa[3]=1; } if(directY==1) { sa[1] =1; sa[3]=0; sa[2]=1; } if(directY==-1) { sa[1]=-1; sa[3]=0; sa[2]=1; } } } if(map[sx+directX][sy+directY]==9) { map[rx][ry]=0; gotoxy(ax+directX,ay+directY); printf(" "); f++; v=0; } gotoxy(70,20); printf("먹은사과 %d",f); if(map[sx+directX][sy+directY]==5||map[sx+directX][sy+directY]==3) { r=0; } } Sleep(100); } else { gotoxy(sx,sy); setColor(2); printf("!"); Sleep(2000); for(i=1; i<=100; i++) { for(o=1; o<=25; o++) { gotoxy(i,o); printf(" "); } } gotoxy(50,20); printf("game over"); Sleep(500); gotoxy(1,1); break; } } }
0
0
3
sooho0506
2022년 2월 06일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 int map[50][50] = {0}; void gotoxy(int x,int y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(int x) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x); } int main() { char x; int sx = 5, sy = 5, directX = 0, directY = 0,yju = 0,yjd = 0,a[101][2],b=4,i,o,rx,ry,ax=0,ay=0,u=0,v=0,f=0,r=1,px,py,p=0,pr,pp=5,ppp=1; srand(time(NULL)); setColor(2); for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } while(1) { if(ax==1) { ax++; } if(ay==1) { ay++; } if(v==0) { if(2>rand()%10) { rx=rand()%24+1; ry=rand()%24+1; gotoxy(rx,ry); printf("@"); map[rx][ry]=9; v=1; } } ax=rx; ay=ry; { gotoxy(sx,sy); printf(" "); map[sx][sy]=0; sx += directX; sy += directY; gotoxy(sx,sy); printf("+"); map[sx][sy]=2; if(r==0) { gotoxy(sx,sy); setColor(2); printf("!"); Sleep(2000); for(i=1;i<=100;i++) { for(o=1;o<=25;o++) { gotoxy(i,o); printf(" "); } } gotoxy(50,20); printf("game over"); Sleep(500); gotoxy(1,1); break; } if(ppp==0) { map[px][py]=0; gotoxy(px,py); printf(" "); ppp=1; p=0; } if(p==0) { pr=rand()%24+1; if(pr==1) { pr++; } px=pr; py=1; p=1; } if(py==1) { gotoxy(px,py); printf("#"); } else { gotoxy(px,py); printf(" "); map[px][py]=0; } gotoxy(px,py+1); py++; printf("$"); map[px][py]=3; if(py==25) { p=0; gotoxy(px,py); printf("#"); map[px][py]=5; } /* for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { gotoxy(i+30,o); if(map[i][o]==5||map[i][o]==9||map[i][o]==3||map[i][o]==2) { setColor(4); } else { setColor(1); } printf("%d",map[i][o]); } printf("\n"); }*/ if(kbhit()) { x = getch(); switch(x) { case LEFT: directX = -1; directY=0; break; case RIGHT: directX = 1; directY=0; break; case UP: directY=-1; directX=0; break; case DOWN: directY=1; directX=0; break; } } if(map[sx+directX][sy+directY]==9) { map[rx][ry]=0; gotoxy(ax+directX,ay+directY); printf(" "); f++; v=0; } gotoxy(70,20); printf("먹은사과 %d",f); if(map[px][py+4]==2) { pp=pp-1; ppp=0; } gotoxy(70,15); printf("Hp %d",pp); if(pp==0) { r=0; } if(map[sx+directX][sy+directY]==5) { r=0; } if(map[px][py+1]==9) { v=0; } } Sleep(100); } }
0
0
3
sooho0506
2022년 2월 06일
In 소스 코드 제출
#include <stdio.h> #include<math.h> #include <time.h> #include <windows.h> #define LEFT 75 #define RIGHT 77 #define UP 72 #define DOWN 80 int map[50][50] = {0}; void gotoxy(int x,int y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void setColor(int x) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x); } int main() { char x; int sx = 5, sy = 5, directX = 0, directY = 0,yju = 0,yjd = 0,a[101][2],b=4,i,o,rx,ry,ax=0,ay=0,u=0,v=0,f=0,r=1; srand(time(NULL)); for(i=1; i<=25; i++) { for(o=1; o<=25; o++) { if(i==1||o==1||o==25||i==25) { gotoxy(i,o); printf("#"); map[i][o]=5; } printf(" "); } printf("\n"); } while(1) { if(ax==1) { ax++; } if(v==0) { if(2>rand()%10) { rx=rand()%24+1; ry=rand()%24+1; gotoxy(rx,ry); printf("@"); map[rx][ry]=9; v=1; } } ax=rx; ay=ry; { gotoxy(sx,sy); printf(" "); sx += directX; sy += directY; gotoxy(sx,sy); printf("+"); if(r==0) { gotoxy(sx,sy); setColor(2); printf("!"); Sleep(2000); for(i=1;i<=100;i++) { for(o=1;o<=25;o++) { gotoxy(i,o); printf(" "); } } gotoxy(50,20); printf("game over"); Sleep(500); gotoxy(1,1); break; } if(kbhit()) { x = getch(); switch(x) { case LEFT: directX = -1; directY=0; break; case RIGHT: directX = 1; directY=0; break; case UP: directY=-1; directX=0; break; case DOWN: directY=1; directX=0; break; } } if(map[sx+directX][sy+directY]==9) { map[rx][ry]=0; gotoxy(ax+directX,ay+directY); printf(" "); f++; v=0; }gotoxy(70,20);printf("먹은사과 %d",f); if(map[sx+directX][sy+directY]==5) { r=0; } } Sleep(100); } }
0
0
5
sooho0506
더보기
bottom of page