코드업 기초 100제 풀이 (내코드)
1081
#include <stdio.h>
int main(){
int n,m,i,j;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
printf("%d %d\n",i,j);
}
}
return 0;
}
1082
#include <stdio.h>
int main(){
int n, i;
scanf("%X", &n);
for (i = 1;i <16;i++){
printf("%X*%X=%X\n", n, i, n*i);
}
return 0;
}
1083
#include <stdio.h>
int main(){
int i,a = 0;
scanf("%d",&a);
for(i=1;i<=a;i++){
if(i==3 || i==6 || i==9){
printf("X ");
}else{
printf("%d ",i);}
}
return 0;
}
1084
#include <stdio.h>
int main(){
int i,j,k;
int r,g,b;
int comment = 0;
scanf("%d %d %d",&r,&g,&b);
for(i=0;i<r;i++){
for(j=0;j<g;j++){
for(k=0;k<b;k++){
printf("%d %d %d\n",i,j,k);
comment++;
}
}
}
printf("%d",comment);
return 0;
}
1085
#include <stdio.h>
int main(){
double h,b,c,s;
double total;
scanf("%lf %lf %lf %lf",&h,&b,&c,&s);
total = (h*b*c*s)/8/1024/1024;
printf("%.1lf MB\n",total);
return 0;
}
1086
#include <stdio.h>
int main(){
double w,h,b;
double total;
scanf("%lf %lf %lf",&w,&h,&b);
total = w*h*b/8/1024/1024;
printf("%.2lf MB\n",total);
return 0;
}
1087
#include <stdio.h>
int main(){
int i,a = 0;
int num = 0;
scanf("%d",&a);
for(i=1;;i++){
num+=i;
if(a<=num){
break;
}
}
printf("%d\n", num);
return 0;
}
1088
#include <stdio.h>
int main(){
int i,n = 0;
scanf("%d",&n);
for(i=1;i<=n;i++){
if(i%3==0){
continue;
}else{
printf("%d ",i);}
}
return 0;
}
1089
#include <stdio.h>
int main(){
int i = 0;
int a,d,n;
int total = 0;
scanf("%d %d %d",&a,&d,&n);
total = a+(d*(n-1));
printf("%d\n",total);
return 0;
}
1090
#include<stdio.h>
int main(){
long long int a,b,c;
scanf("%lld %lld %lld",&a,&b,&c);
for(int j = 1; j <c; j++){
a *= b;
}
printf("%lld",a);
return 0;
}
1091
#include<stdio.h>
int main(){
long long int a,m,d,n;
scanf("%lld %lld %lld %lld",&a,&m,&d,&n);
for(int j = 1; j <n; j++){
a *= m;
a += d;
}
printf("%lld",a);
return 0;
}
1092
#include <stdio.h>
int main() {
int a, b, c, day = 1;
scanf("%d%d%d", &a, &b, &c);
while (day%a != 0 || day%b != 0 || day%c != 0){
day++;}
printf("%d", day);
return 0;
}
1093
#include <stdio.h>
int main(){
int i, j, k, a[24];
scanf("%d", &k);
for(i=0; i<k; i++)
{
scanf("%d", &j);
a[j]++;
}
for(i=1; i<=23; i++)
{
printf("%d ",a[i]);
}
return 0;
}
1094
#include <stdio.h>
int i, j, k, a[10000];
int main(){
scanf("%d",&k);
for(i=0; i<k; i++)
scanf("%d", &a[i]);
for(i=k-1; i>=0; i--)
printf("%d ", a[i]);
return 0;
}
1095
#include <stdio.h>
int main(){
int i, j, k;
int a[10000] = {0};
int min = 24;
scanf("%d", &k);
for(i=0; i<k; i++){
scanf("%d", &a[i]);
if(min > a[i]){
min =a[i];
}
}
printf("%d", min);
return 0;
}
1096
#include <stdio.h>
int main(){
int n, i, j, a, b;
int map[20][20];
scanf("%d", &n);
for(i=0; i < n; i++){
scanf("%d%d", &a, &b);
map[a][b] = 1;
}
for(i=1; i <= 19; i++){
for(j=1; j <= 19; j++){
printf("%d ", map[i][j]);
}
printf("\n");
}
return 0;
}
1097
#include <stdio.h>
int main(){
int ground[19][19];
int i,j,x,y,n;
for(i=0;i<19;i++){
for(j=0;j<19;j++){
scanf("%d",&ground[i][j]);}
}
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d",&x,&y);
for(j=1;j<=19;j++){ //x축 바꾸기
ground[x-1][j-1] = !ground[x-1][j-1];
}
for(j=1;j<=19;j++){ //y축 바꾸기
ground[j-1][y-1] = !ground[j-1][y-1];
}
}
for(i=0;i<19;i++){
for(j=0;j<19;j++){
printf("%d ",ground[i][j]);}
printf("\n");
}
return 0;
}
1098
#include <stdio.h>
int main(){
//문제 옵션
int w,h; //가로-세로
int n; //막대의 개수(test_case)
int l,v,x,y; //길이,방향,x-y좌표
//구성 변수
int ground[101][101]; //100*100의 공간 생성
int i,j;
//구성시작
scanf("%d %d",&h,&w);
for(i=1;i<=h;i++){
for(j=1;j<=w;j++){
ground[i][j]=0;}
}
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d %d %d %d",&l,&v,&y,&x);
if(v==0){ //가로
for(j=x;j<x+l;j++){
ground[y][j] = !ground[y][j];
}
}
else if(v==1){ //세로
for(j=y;j<y+l;j++){
ground[j][x] = !ground[j][x];
}
}
}
for(i=1;i<=h;i++){
for(j=1;j<=w;j++){
printf("%d ",ground[i][j]);}
printf("\n");}
return 0;
}
1099
#include <stdio.h>
int main(){
int ground[10][10];
int x=1,y=1;
int i,j;
for(i=0;i<10;i++){
for(j=0;j<10;j++){
scanf("%d",&ground[i][j]);
}
}
while(1){
if(ground[y][x] == 0){
ground[y][x] = 9;
x++;
}
if(ground[y][x] == 1){
x--;
y++;
}
if(ground[y][x+1] == 1 && ground[y+1][x] == 1){
ground[y][x] = 9;
break;
}
else if(ground[y][x] == 2 && ground[y][x] == 2){
ground[y][x] = 9;
break;
}
}
for(i=0;i<10;i++){
for(j=0;j<10;j++){
printf("%d ",ground[i][j]);
}
printf("\n");
}
return 0;
}
'IT Study > Programming' 카테고리의 다른 글
[C] codeup 기초 100제[1061:1080] (0) | 2021.06.03 |
---|---|
[C] codeup 기초 100제[1041:1060] (0) | 2021.06.03 |
[C] codeup 기초 100제[1021:1040] (0) | 2021.06.03 |
[C] codeup 기초 100제[:1020] (0) | 2021.01.24 |