top of page

게시판 게시물

taei0623
2023년 10월 06일
In 소스 코드 제출
# a,b = input().split()# a = int(a)# b = int(b)# print(b >=# a,b = input().split()# a = int(a)# b = int(b)# print(a != b)# a = input()# a = int(a)# print(a != 0)# a = input()# a = int(a)# print(bool(a))# a = bool(int(input()))# print(not a)# a,b = input().split()# print(bool(int(a)) and bool(int(b)))# a,b = input().split()# a = bool(int(a))# b = bool(int(b))# print(a or b)# a,b = input().split()# a = bool(int(a))# b = bool(int(b))# print(a != b)# a,b = input().split()# a = bool(int(a))# b = bool(int(b))# print(a == b)
0
0
1
taei0623
2023년 9월 10일
In 소스 코드 제출
#a,b = input().split() #print(b, a) '''a = str(input() )print(a ,a ,a )''''''a, b = input().split(':')print(a, b, sep=':')''''''a, b, c = input().split(sep='.')print(c, b, a,sep='-')''''''a,b = input().split(sep='-')print(a,b,sep="")'''# a = input()# print(a[0])# print(a[1:4])# print(a*3)# 6027 6028 6029 6046 6047 6059-6062는 빼고!!!!!!!!# 아스키코드(정수) -> 문자   chr(아스키코드)# 문자->아스키코드(정수) ord(문자)# 비교연산자 > < >= <= == !=# not a>0# a>10 and b==10# a>10 or b==9# print(10<8)a = input()
0
0
5
taei0623
2023년 7월 30일
In 소스 코드 제출
/* #include <stdio.h> #include <string.h> char mysubstr(char str,int start,int count) { str[start+count] = NULL; return str+start; } int main() { char str[101]={}; int start,count; scanf("%s %d %d",str,&start,&count); printf("%s",mysubstr(str,start,count)); return 0; } */ #include<stdio.h> int main() { int time1,time2,cooktime; scanf ("%d %d %d",&time1,&time2,&cooktime); if (time2+cooktime>59) { for (int i=0;i<=0;i++) { if(time2<60) break; time2=time2+cooktime-60; time1++; } printf ("%d %d",time1,time2); } else { time2=time2+cooktime; printf ("%d %d",time1,time2); } }
0
0
1
taei0623
2023년 7월 16일
In 소스 코드 제출
/* 포인터 pointer - 가리키는애 주소를 저장하는 변수 int a -> 정수 int* pa -> 정수변수의 주소 int* pa=&a; printf("&a : %d\n",&a); printf("pa : %d\n",pa); printf("*pa : %d\n",*pa); // *pa : pa가 가리키고있는 곳의 값 #include <stdio.h> void f(int* b){ printf("제가 받은 주소값은 %d입니다\n",b); printf("그 주소에 갔더니 있는 값은 %d입니다\n",*b); printf("그래서 제가 그 값은 100으로 바꿀겁니다.\n"); *b=100; printf("끝났습니다.\n"); } int main() { int a=10; printf("f함수를 실행하기 전의 a값은 %d입니다.\n\n",a); f(&a); printf("\n\na의 값은 %d입니다.",a); return 0; } */ /* #include <stdio.h> void myswap(int* a,int* b) { int t; if (*a>*b) { t=*a; a=b; *b=t; } } main() { int a, b; scanf("%d%d", &a, &b); myswap(&a, &b); printf("%d %d", a, b); } */ /* #include <stdio.h> void f(int* a,int n) { //a[i] = *(a+i) for(int i=0;i<n;i++){ printf("%d ",a[i]); } //a[5]=100; *(a+5)=100; //printf("%d",a[5]); } int main() { int arr[500]={4,5,6,1,2,3,7,8,9,1,2,3,4,5,6,7}; //f(&arr[0]); // arr = &arr[0] f(arr,16); printf("\n"); for(int i=0;i<16;i++){ printf("%d ",arr[i]); } return 0; } #include <stdio.h> void f(char* a) { printf("%s",a); // for(int i=0;a[i]!=NULL;i++){ // printf("%c ",a[i]); // } *(a+5)='-'; } int main() { char str[50]="hello world hi taei bye"; f(str); printf("\n"); for(int i=0;str[i]!=NULL;i++){ printf("%c",str[i]); } return 0; } int* arr; int * arr; int *arr; 셋 다 똑같음!! 하지만 int의주소를 저장하는 변수라는 뜻을 강조하기 위해 int* arr; 쓰는것을 권장합니다!!! */ #include<stdio.h> #include<string.h> char* mysubstr(char* str,int start,int count) { } int main() { char str[100]={}; int start,count; for (int i=0;i<=100;i++) { scanf("%d",&str[i]); } scanf("%d %d",&start,&count); mysubstr(str,start,count); printf("%d"); }
0
0
5
taei0623
2023년 7월 09일
In 소스 코드 제출
//#include <stdio.h> // //struct _things //{ // char name[11]; // int score1,score2,score3; //}; //int main() //{ // struct _things arr[101]={}; // int a=0,n; // scanf("%d",&n); // for (int i=0;i<n;i++) // { // scanf (" %s %d %d %d",arr[i].name,&arr[i].score1,&arr[i].score2,&arr[i].score3); // } // a=0; // for (int i=0;i<n;i++) // { // if(arr[i].score1>arr[a].score1) // { // a=i; // } // } // printf("%s ",arr[a].name); // int b=0; //내가 몇등인지? 나보다 잘한애가 몇명인지?+1 // int c = 0; // for (int i=0;i<n;i++) // { // if(arr[a].score2<arr[i].score2) b++; // if(arr[a].score3<arr[i].score3) c++; // } // printf("%d %d",b+1,c+1); // return 0; //} #include<stdio.h> struct _things { char name[11]; int score; }; int main() { int n,m,a; scanf("%d %d",&n,&m); for (int) }
0
0
1
taei0623
2023년 7월 02일
In 소스 코드 제출
/* #include <stdio.h> struct _node { int name,num,score; }; int main() { struct _node arr[101]; int i,n,a=1,b=1,c=1; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d %d %d",&arr[i].name,&arr[i].num,&arr[i].score); } //1등 for (int i=1;i<=n;i++) { if(arr[i].score>arr[a].score) { a=i; } } arr[a].score=0; printf("%d %d\n",arr[a].name,arr[a].num); //2등 for (int i=1;i<=n;i++) { if(arr[i].score>arr[b].score ) { b=i; } } arr[b].score=0; printf("%d %d\n",arr[b].name,arr[b].num); //3등구하기 ((나라별 메달 수는 최대 두 개)) if (arr[a].name == arr[b].name) { //그 나라에속하는 학생들 다 0점처리 for(int i=1;i<=n;i++) { if (arr[i].name==arr[a].name) { arr[i].score=0; } } } for (int i=1;i<=n;i++) { if(arr[i].score>arr[c].score) { c=i; } } printf("%d %d\n",arr[c].name,arr[c].num); return 0; } */
0
0
2
taei0623
2023년 6월 25일
In 소스 코드 제출
#include <stdio.h> struct _node { int things,num,score; }; int main() { struct _node arr[101]; int i,n,a=0; scanf ("%d",&n); for (int i=0;i<n;i++) { scanf("%d %d %d",&arr[i].things,&arr[i].num,&arr[i].score); } for (int i=0;i<n;i++) { if(arr[i]>a) { a=arr[i]; } } return 0; }
0
0
5
taei0623
2023년 6월 18일
In 소스 코드 제출
/* #include <stdio.h> void printstar(int n) { if (n == 0) { printf("\n"); return; } printf("*"); printstar(n - 1); } void rec(int n) { if (n == 0) return; rec(n - 1); printstar(n); } int main() { int n; scanf("%d",&n); rec(n); return 0; } */ /* #include<stdio.h> void rec(int n) { if (n == 0) { return; } rec(n / 2); printf("%d",n%2); } int main() { int n; scanf("%d", &n); if (n == 0) { printf("0"); } else { rec(n); } return 0; } */ /* #include<stdio.h> struct _node { int score; int math, kor, eng; char name[100]; }; int main() { struct _node x; struct _node p[10]; x.eng = 100; p[0].eng = 200; } */ #include<stdio.h> struct _haha { int number, score; }; int main() { struct _haha h[105]; }
0
0
6
taei0623
2023년 6월 11일
In 소스 코드 제출
/* #include <stdio.h> void rec(int n) { if (n <= 0) return; printf("*"); rec (n-1); } int main() { int n; scanf("%d", &n); rec(n); return 0; } */ /* #include <stdio.h> void rec(int n) { if (n <= 0) return; rec(n-1); printf("%d ", n); } int main() { int n; scanf("%d", &n); rec(n); return 0; } */ /* #include <stdio.h> int rec(int n) { if (n<=2) return 1; return rec(n-1) + rec(n-2); } int main() { int n; scanf ("%d",&n); printf("%d",rec(n)); return 0; } */ /* #include<stdio.h> int arr[201]={}; int rec(int n) { if (arr[n] != 0) return arr[n]; if (n<=2) return 1; return arr[n] = (rec(n-1) + rec(n-2)) % 10009; } int main() { int n; scanf("%d",&n); printf("%d",rec(n)); return 0; } */ /* #include <stdio.h> void rec(int n) { printf("%d\n",n); if(n==1) return; if (n % 2 == 1) rec(3*n+1); else rec(n/2); } int main() { int n; scanf("%d",&n); rec(n); return 0; } */ /* #include <stdio.h> void rec(int n) { if(n==1) { printf("1\n"); return; } if(n%2==1) rec(3*n+1); else rec(n/2); printf("%d\n",n); } int main() { int n; scanf("%d",&n); rec(n); return 0; } rec(n) : 리턴 (1~n합) : 리턴 (1~n-1합 + n) : 리턴 rec(n-1)+n */ #include <stdio.h> int rec(int n) { if (n==1) return 1; else return rec(n-1) + n; } int main() { int n; scanf("%d",&n); printf("%d",rec(n)); }
0
0
4
taei0623
2023년 5월 28일
In 소스 코드 제출
/* #include <stdio.h> int arr [201]={}; int fib(int n) { if(arr[n]!=0) return arr[n]; if(n==1||n==2) return 1; else return arr[n] = (fib(n-1) + fib(n-2))%10009; } int main() { int n; scanf("%d",&n); printf("%d",fib(n)); return 0; } 1901 ~ 1916 */ /* #include<stdio.h> void rec (int n) { if (n==0) return; rec(n-1); printf("%d\n",n); } int main() { int n; scanf ("%d",&n); rec(n); return 0; } */ /* #include<stdio.h> void rec(int n1,int n2) { if(n1-1==n2) return; rec(n1,n2-1); if (n2 % 2 == 1) { printf("%d ",n2); } } int main() { int n1,n2; scanf("%d %d",&n1,&n2); rec(n1,n2); return 0; } */ #include<stdio.h> int a=0; void rec(int n) { if (n==0) { printf("%d",a); return; } rec(n-1); a=a+n; } int main() { int n; scanf("%d",&n); rec(n); return 0; }
0
0
1
taei0623
2023년 5월 28일
In 소스 코드 제출
/* //pacman game #include <stdio.h> #include <stdbool.h> #include <conio.h> // for getch() function (Windows only) const int BOARD_SIZE = 10; char board[10][10] = { {'#', '#', '#', '#', '#', '#', '#', '#', '#', '#'}, {'#', '.', '.', '.', '.', '.', '.', '.', '.', '#'}, {'#', '.', '#', '#', '#', '#', '#', '#', '.', '#'}, {'#', '.', '#', '.', '.', '.', '.', '#', '.', '#'}, {'#', '.', '#', '.', '#', '#', '.', '#', '.', '#'}, {'#', '.', '#', '.', '#', '#', '.', '#', '.', '#'}, {'#', '.', '.', '.', '.', '.', '.', '.', '.', '#'}, {'#', '#', '#', '#', '#', '#', '#', '#', '#', '#'}, }; // Function to draw the game board void drawBoard(int pacmanX, int pacmanY, int ghostX[], int ghostY[], int numGhosts) { system("cls"); // Clear the console (Windows only) for (int i = 0; i < BOARD_SIZE; i++) { for (int j = 0; j < BOARD_SIZE; j++) { if (i == pacmanY && j == pacmanX) { printf("C "); // Draw Pacman } else { bool ghostPresent = false; for (int k = 0; k < numGhosts; k++) { if (i == ghostY[k] && j == ghostX[k]) { printf("G "); // Draw Ghost ghostPresent = true; break; } } if (!ghostPresent) { printf("%c ", board[i][j]); // Draw walls and dots } } } printf("\n"); } } bool isWall(int x, int y) { return board[y][x] == '#'; } int main() { int pacmanX = BOARD_SIZE / 2; int pacmanY = BOARD_SIZE / 2; const int numGhosts = 3; int ghostX[numGhosts]; int ghostY[numGhosts]; bool gameOver = false; // Initialize the positions of each ghost ghostX[0] = 4; ghostY[0] = 2; ghostX[1] = 2; ghostY[1] = 5; ghostX[2] = 7; ghostY[2] = 3; ghostX[3] = 5; ghostY[3] = 6; ghostX[4] = 8; ghostY[4] = 4; while (!gameOver) { drawBoard(pacmanX, pacmanY, ghostX, ghostY, numGhosts); char input = getch(); // Get user input (Windows only) // Store the previous positions int prevPacmanX = pacmanX; int prevPacmanY = pacmanY; int prevGhostX[numGhosts]; int prevGhostY[numGhosts]; for (int i = 0; i < numGhosts; i++) { prevGhostX[i] = ghostX[i]; prevGhostY[i] = ghostY[i]; } // Move Pacman based on user input switch (input) { case 'w': pacmanY--; break; case 'a': pacmanX--; break; case 's': pacmanY++; break; case 'd': pacmanX++; break; case 'q': gameOver = true; break; } // Check if Pacman hits a wall if (isWall(pacmanX, pacmanY)) { pacmanX = prevPacmanX; pacmanY = prevPacmanY; } // Move each Ghost randomly for (int i = 0; i < numGhosts; i++) { int randomMove = rand() % 4; switch (randomMove) { case 0: ghostY[i]--; break; case 1: ghostX[i]--; break; case 2: ghostY[i]++; break; case 3: ghostX[i]++; break; } // Check if each Ghost hits a wall if (isWall(ghostX[i], ghostY[i])) { ghostX[i] = prevGhostX[i]; ghostY[i] = prevGhostY[i]; } } // Check if Pacman and Ghosts collide for (int i = 0; i < numGhosts; i++) { if (pacmanX == ghostX[i] && pacmanY == ghostY[i]) { gameOver = true; printf("Game Over!\n"); break; } } } return 0; } */ /* //Keep away from the zombie #include <stdio.h> #include <stdbool.h> #include <conio.h> // for getch() function (Windows only) const int BOARD_SIZE = 10; char board[1000][1000] = { {'#', '#', '#', '#', '#', '#', '#', '#', '#', '#'}, {'#', '.', '.', '.', '.', '.', '.', '.', '.', '#'}, {'#', '.', '#', '#', '#', '#', '#', '#', '.', '#'}, {'#', '.', '#', '.', '.', '.', '.', '#', '.', '#'}, {'#', '.', '#', '.', '#', '#', '.', '#', '.', '#'}, {'#', '.', '#', '.', '#', '#', '.', '#', '.', '#'}, {'#', '.', '.', '.', '.', '.', '.', '.', '.', '#'}, {'#', '#', '#', '#', '#', '#', '#', '#', '#', '#'}, }; // Function to draw the game board void drawBoard(int playerX, int playerY, int zombieX, int zombieY, int bulletX, int bulletY) { system("cls"); // Clear the console (Windows only) for (int i = 0; i < BOARD_SIZE; i++) { for (int j = 0; j < BOARD_SIZE; j++) { if (i == playerY && j == playerX) { printf("P "); // Draw player } else if (i == zombieY && j == zombieX) { printf("Z "); // Draw zombie } else if (i == bulletY && j == bulletX) { printf("* "); // Draw bullet } else { printf("%c ", board[i][j]); // Draw walls and empty spaces } } printf("\n"); } } bool isWall(int x, int y) { if (x < 0 || x >= BOARD_SIZE || y < 0 || y >= BOARD_SIZE) return true; // Out of board bounds return board[y][x] == '#'; } int main() { int playerX = BOARD_SIZE / 2; int playerY = BOARD_SIZE / 2; int zombieX = 1; int zombieY = 1; int bulletX = -1; // Initialize bullet position to be outside the board int bulletY = -1; bool gameOver = false; while (!gameOver) { drawBoard(playerX, playerY, zombieX, zombieY, bulletX, bulletY); char input = getch(); // Get user input (Windows only) // Store the previous player position int prevPlayerX = playerX; int prevPlayerY = playerY; // Move player based on user input switch (input) { case 'w': playerY--; break; case 'a': playerX--; break; case 's': playerY++; break; case 'd': playerX++; break; case ' ': // Shoot bullet if (bulletX == -1 && bulletY == -1) { bulletX = playerX; bulletY = playerY; } break; case 'q': gameOver = true; break; } // Check if player hits a wall if (isWall(playerX, playerY)) { playerX = prevPlayerX; playerY = prevPlayerY; } // Move zombie towards the player int dx = 0; int dy = 0; if (zombieX < playerX) { dx = 1; } else if (zombieX > playerX) { dx = -1; } if (zombieY < playerY) { dy = 1; } else if (zombieY > playerY) { dy = -1; } // Check if the zombie can move in the intended direction if (!isWall(zombieX + dx, zombieY)) { zombieX += dx; } if (!isWall(zombieX, zombieY + dy)) { zombieY += dy; } // Move bullet if (bulletX != -1 && bulletY != -1) { bulletY--; if (isWall(bulletX, bulletY)) { bulletX = -1; bulletY = -1; } } // Check if player and zombie collide if (playerX == zombieX && playerY == zombieY) { gameOver = true; printf("Game Over!\n"); } } return 0; } */ /* //platformer game #include <stdio.h> #include <stdlib.h> #include <conio.h> // for getch() function (Windows only) #include <windows.h> // for Sleep function (Windows only) const int SCREEN_WIDTH = 40; const int SCREEN_HEIGHT = 20; const char PLAYER_CHAR = '@'; const char ENEMY_CHAR = '*'; const char PLATFORM_CHAR = '#'; char screen[20][40]; int playerX, playerY; int isJumping; int jumpPower; int jumpTime; typedef struct { int x; int y; int isAlive; } Enemy; Enemy enemies[5]; // Array to store enemy positions int numEnemies = 5; void initializeScreen() { for (int i = 0; i < SCREEN_HEIGHT; i++) { for (int j = 0; j < SCREEN_WIDTH; j++) { if (i == SCREEN_HEIGHT - 1) screen[i][j] = PLATFORM_CHAR; // Create a platform at the bottom else screen[i][j] = ' '; // Empty space } } } void drawScreen() { system("cls"); // Clear the console (Windows only) for (int i = 0; i < SCREEN_HEIGHT; i++) { for (int j = 0; j < SCREEN_WIDTH; j++) { printf("%c", screen[i][j]); } printf("\n"); } } void updatePlayerPosition(char input) { switch (input) { case 'a': if (playerX > 0) playerX--; break; case 'd': if (playerX < SCREEN_WIDTH - 1) playerX++; break; case 'w': if (!isJumping && playerY == SCREEN_HEIGHT - 2) { // Only allow jumping from the ground isJumping = 1; jumpPower = 5; // Adjust the jump power as desired jumpTime = 0; } break; } } void updateJump() { if (isJumping) { if (jumpTime < jumpPower) { playerY--; jumpTime++; } else { isJumping = 0; jumpTime = 0; } } else { if (playerY < SCREEN_HEIGHT - 2) { playerY++; } } } void updateEnemies() { for (int i = 0; i < numEnemies; i++) { // Update enemy positions enemies[i].x++; // Check if the enemy reaches the end of the screen, reset its position if (enemies[i].x >= SCREEN_WIDTH) enemies[i].x = 0; // Check if the enemy collides with the player if (enemies[i].x == playerX && enemies[i].y == playerY) { // Handle collision, such as game over or player damage // Here, we check if the player is jumping on the enemy if (isJumping && jumpTime < jumpPower) { enemies[i].isAlive = 0; // Enemy is defeated playerY--; // Bounce the player up } else { // Handle collision, such as game over or player damage printf("Game Over\n"); Sleep(2000); // Delay for 2 seconds exit(0); // Exit the game } } } } int main() { initializeScreen(); playerX = SCREEN_WIDTH / 2; playerY = SCREEN_HEIGHT - 2; isJumping = 0; jumpPower = 0; jumpTime = 0; for (int i = 0; i < numEnemies; i++) { enemies[i].x = rand() % SCREEN_WIDTH; enemies[i].y = SCREEN_HEIGHT - 3; // Set y position above the ground enemies[i].isAlive = 1; // Set enemy as alive } while (1) { drawScreen(); char input; // Check if a key is pressed if (_kbhit()) { input = _getch(); // Get user input (Windows only) updatePlayerPosition(input); } else { input = ' '; // No key pressed, set input to a default value } // Update the jump updateJump(); // Update the enemies updateEnemies(); // Update the screen with the player's position for (int i = 0; i < SCREEN_HEIGHT; i++) { for (int j = 0; j < SCREEN_WIDTH; j++) { if (i == playerY && j == playerX) printf("%c", PLAYER_CHAR); else { int isEnemy = 0; for (int k = 0; k < numEnemies; k++) { if (enemies[k].x == j && enemies[k].y == i && enemies[k].isAlive) { printf("%c", ENEMY_CHAR); isEnemy = 1; break; } } if (!isEnemy && i == SCREEN_HEIGHT - 1) printf("%c", PLATFORM_CHAR); else printf(" "); } } printf("\n"); } Sleep(100); // Delay for 100 milliseconds } return 0; } */
0
0
3
taei0623
2023년 5월 21일
In 소스 코드 제출
/* #include <stdio.h> void rec(int n) { if(n==0) return ; rec(n -1); printf ("%d ", n); } int main() { int n; scanf ("%d",&n); rec(n); return 0; } rec(n) : 1~ n 합 리턴 : 1 ~ n-1합 + n 리턴 : rec(n-1) + n 리턴 int rec(int n) { if(n==1) return 1; else return n+rec(n-1); } */ /* #include<stdio.h> int rec(int n) { if(n==1) return 1; else return n+rec(n-1); } int main() { int n; scanf("%d",&n); printf("%d",rec(n)); return 0; } */ int rec (long long int n) { rec(); } int main () { array long long int n; scanf("%d", &n); printf("%d",rec(n)); return 0; }
0
0
1
taei0623
2023년 5월 14일
In 소스 코드 제출
/* #include <stdio.h> int n, a, b, d[1010]; long long int subsetsum(int na,int nb) { long long int g=0; for (int i=na;i<=nb;i++) { g=g+d[i]; } return g; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &d[i]); scanf("%d%d", &a, &b); printf("%lld\n", subsetsum(a, b)); } */ /* #include <stdio.h> int a, n; long long int pow(int na,int nb) { long long int g=1; if (na==1) { return 1; } for (int i=1;i<=nb;i++) { g=g*na; } return g; } int main() { scanf("%d%d", &a, &n); printf("%lld\n", pow(a, n)); } 재귀함수 : recursive function * 특징 1. 코드가 짧아 -> 어려웡... 2. 말이 돼 -> 뭔소린지 모르겠어... 내가할라면 못쓰겠어.. * 정의 1. 함수 내에서 자신을 호출하는 함수 f() { f(); } main() { f(); } 2. 자신으로 다시 정의내리는 함수 f() or rec() 1. rec(n) : n부터 1까지 출력 n출력 -> n-1출력 -> .... 2출력-> 1출력 n출력 -> n-1부터 1까지 출력 n출력 -> rec(n-1) #include <stdio.h> void rec(int n) { if(n==0) return ; printf("%d ",n); rec(n-1); } int main() { rec(5); return 0; } 2. rec(n) : 1 부터 n까지 출력 1출력 -> 2출력 -> ... n-1출력 -> n출력 1 부터 n-1까지 출력 -> n출력 rec(n-1) -> n출력 #include <stdio.h> int n; void rec(int g) { if (g==0) return; rec(g-1); printf ("%d\n",g); } int main() { scanf ("%d",&n); rec(n); return 0; } rec(a, b) : a부터 b까지 출력 */ #include<stdio.h> void rec(int a,int b) { } int main() { }
0
1
9
taei0623
2023년 5월 07일
In 소스 코드 제출
/* #include <stdio.h> int f(int n) { int sum=0; while(n!=0) { sum+=n%10; n=n/10; } return sum; } int main() { int n, m; scanf("%d",&n); for (;;) { m = f(n); // n의 자릿수의 합 구하기 if(m<10) { break; } else { n=m; } } printf ("%d",m); } */ #include <stdio.h> long long int n; long long int f(long long int inputnumber) { long long int r=0; while (inputnumber!=0) { r=r*10+inputnumber%10; inputnumber/=10; } return r; } int main() { scanf("%lld", &n); printf("%lld\n", f(n)); }
0
0
0
taei0623
2023년 4월 30일
In 소스 코드 제출
/* #include <stdio.h> int n, d[100010], k; int f(int k) { for (int i=1;i<=n;i++) { if (d[i] == k) { return i; } } return -1; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &d[i]); scanf("%d", &k); printf("%d\n", f(k)); } */ /* #include <stdio.h> int n, k, d[1010]; int lower_bound(int k) { for (int i=1 ; i<=n ; i++) { if (d[i] >=k ) return i; } return n+1; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &d[i]); scanf("%d", &k); printf("%d\n", lower_bound(k)); } */ /* #include <stdio.h> int n, d[110]; int f() { int ai=0; // 가장큰값의 위치 int a=0; // a는 가장 큰 값 for (int i=0;i<n;i++) { if (d[i]>a) { a=d[i]; ai=i; } } return ai+1; } int main() { scanf("%d", &n); for(int i=0; i<n; i++) scanf("%d", &d[i]); printf("%d", f()); return 0; } */ /* #include <stdio.h> int n; long long int d[110]; long long int f() { long long int a=1000000000; for (int i=1;i<=n;i++) { if (d[i]<a) { a=d[i]; } } return a; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%lld", &d[i]); printf("%lld", f()); return 0; } */ #include <stdio.h> int n, a, b, d[1010]; int maxi(int g,int h) { int c=g; for (int i=g;i<=h;i++) { if (d[i]>d[c]) { c=i; } } return c; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &d[i]); scanf("%d%d", &a, &b); printf("%d\n", maxi(a, b)); }
0
0
2
taei0623
2023년 4월 23일
In 소스 코드 제출
// 함수 function -> f func /* #include <stdio.h> int k=10; //전역변수 global variables //void f(int n) //{ // for(int i=0;i<n;i++) // printf("Hello world!\n"); //} int f(int n,int m) { return n+m; } int main() { printf("%d",f(5,10)); return 0; } #include <stdio.h> int n; void f(int n) { if(n==1) } int main() { scanf("%d", &n); f(n); return 0; } */ /* #include <stdio.h> int n; void f(int n) { if (n==1) { printf ("hello"); } else if (n==2) { printf ("world"); } } int main() { scanf("%d", &n); f(n); return 0; } */ /* #include <stdio.h> int n; void f(int n) { for (int i=1;i<=n;i++) { printf ("*"); } } int main() { scanf("%d", &n); f(n); return 0; } */ /* #include <stdio.h> int n; char grade(int n) { if(n>=90 ) return 'A'; else if(n>=80) return 'B'; else if(n>=70) return 'C'; else if(n>=60) return 'D'; else return 'F'; } int main() { scanf("%d", &n); printf("%c", grade(n)); return 0; } */ /* #include <stdio.h> int n; long long int f(int n) { long long int a=0; for (int i=1;i<=n;i++) { a=a+i; } return a; } // 이 부분에 들어가야 될 코드를 작성하여 제출 int main() { scanf("%d", &n); printf("%lld\n", f(n)); } */ /* #include <stdio.h> float circle(float r) { return 3.14*r*r; } main() { int r; scanf("%d", &r); printf("%.2f", circle(r)); } */ #include <stdio.h> int n; long long int d[110]; long long int f() { long long int min=d[1]; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%lld", &d[i]); printf("%lld", f()); return 0; }
0
0
2
taei0623
2023년 4월 16일
In 소스 코드 제출
/* #include <stdio.h> int main() { int n,i,j,k; int arr [101][101]={}; scanf ("%d",&n); // 마방진 채우기 i=1; j=n/2+1; for(k=1;k<=n*n;k++) { arr[i][j]=k; if (arr[i][j] % n == 0) { i++; } else { if(i==1) { i=n; } else { i--; } if(j==n) { j=1; } else { j++; } } } //마방진 출력하기 for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { printf ("%d ",arr[i][j]); } printf ("\n"); } return 0; } */ #include <stdio.h> int main () { int arr [11][11]={}; int i,j; for (i=1;i<=10;i++) { for (j=1;j<=10;j++) { scanf ("%d", &arr[i][j]); } } i=2; j=2; for(;;) { if(arr[i][j]==2) { arr[i][j]=9; break; } arr[i][j]=9; if(arr[i][j+1]!=1) { j++; } else if(arr[i+1][j]!=1) { i++; } else { break; } } for (i=1;i<=10;i++) { for (j=1;j<=10;j++) { printf ("%d ",arr[i][j]); } printf ("\n"); } }
0
0
1
taei0623
2023년 4월 09일
In 소스 코드 제출
/* #include <stdio.h> int main() { int n,i,j,k=1; scanf ("%d",&n); int arr[101][101]= {}; for (i=n; i>=1; i--) { if (i%2==1) { for (j=1; j<=n; j++) { arr[i][j]=k++; } } else { for(j=n;j>=1;j--) { arr[i][j]=k++; } } } for (i=1; i<=n; i++) { for (j=1; j<=n; j++) { printf ("%d ",arr[i] [j]); } printf ("\n"); } return 0; } */ /* #include <stdio.h> int main () { int arr [101][101]={}; int i,j,n,h,w,l,d,x,y; scanf ("%d %d %d",&h,&w,&n); for (i=1;i<=n;i++) { scanf("%d %d %d %d",&l,&d,&x,&y); for (j=0;j<l;j++) { if(d==1) { arr[x+j][y]=1; } else { arr[x][y+j]=1; } } } for (i=1;i<=h;i++) { for (j=1;j<=w;j++) { printf ("%d ",arr[i][j]); } printf ("\n"); } } */ #include <stdio.h> int main () { int n,i, j,k, arr[51][51]={}; scanf ("%d",&n); i=1; j=n/2+1; for(k=1;k<=n*n;k++) { arr[i][j]=k; if(i==1) { i=n; } else { i--; j++; } } for (i=1;i<=n;i++) { for (j=1;j<=n;j++) { printf("%d ",arr[i][j]); } printf("\n"); } }
0
0
8
taei0623
2023년 4월 02일
In 소스 코드 제출
/* #include <stdio.h> int main() { int arr[12][11]={}; int i,j; for (i=1;i<=11;i++) { for (j=1;j<=10;j++) { scanf ("%d",&arr [i][j]); } } for (j=1;j<=10;j++) { if (arr[11][j]==1) { for (i=10;i>=1;i--) { if (arr[i][j] > 0) { printf ("%d crash \n", j); break; } else if (arr[i][j] < 0) { printf ("%d fall \n", j); break; } else if (i == 1) { printf ("%d safe \n",j); } } } } return 0; } */ /* #include <stdio.h> int main () { int arr[11][11]={}; int i,j,r,c; int a=0; for (i=1;i<=9;i++) { for (j=1;j<=9;j++) { scanf ("%d",&arr[i][j]); } } scanf ("%d %d", &r ,&c); if (arr[r][c]==1) { printf ("-1"); } else { for (i=r-1;i<=r+1;i++) { for (j=c-1;j<=c+1;j++) { if (arr[i][j]==1) { a=a+1; } } } printf ("%d",a); } return 0; } */ #include <stdio.h> int main () { int i,j; int } //😎😎😎
0
0
1
taei0623
2023년 3월 26일
In 소스 코드 제출
/* #include <stdio.h> int main(void) { int arr[21][21]={}; int i,j, n; //1. 입력받기 scanf ("%d",&n); for(i=1;i<=n;i++) { scanf ("%d", &arr[i][1]); } // 2. 빈칸 채우기 for (i=2;i<=n;i++) { for (j=2;j<=i;j++) { arr[i][j]=arr[i][j-1]-arr[i-1][j-1]; } } //3. 격자판 출력하기 for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { printf ("%d ", arr[i][j]); } printf ("\n"); } } */ #include<stdio.h> int main () { int arr [12][11]={}; int n,i,j; for (i=1;i<=11;i++) { for (j=1;j<=10;j++) { scanf("%d",&arr[i][j]); } } }
0
0
3

taei0623

더보기
bottom of page