์ƒˆ์†Œ์‹

๐Ÿงฎ PS

์ฝ”๋“œ์—… (Code up) 1001~1027 [ C ์–ธ์–ด ํ’€์ด ]

  • -

codeup.kr/problemsetsol.php?psid=23

 

๋ฌธ์ œ์ง‘ / ๊ธฐ์ดˆ 100์ œ

 

codeup.kr

 

 

1001
#include <stdio.h>
int main(){
    printf("Hello");
    return 0;
}

 

1002
#include <stdio.h>
int main(){
    printf("Hello World");
    return 0;
}

 

1003
#include <stdio.h>
int main(){
    printf("Hello\nWorld");
    return 0;
}

 

 

1004
#include <stdio.h>
int main(){
    printf("\'Hello\'");
    return 0;
}

 

 

1005
#include <stdio.h>
int main(){
    printf("\"Hello World\"");
    return 0;
}

 

 

1006
#include <stdio.h>
int main(){
    printf("\"!@#$%%^&*()\"");
    return 0;
}

 

 

1007
#include <stdio.h>
int main(){
    printf("\"C:\\Download\\hello.cpp\"");
    return 0;
}

 

1010
#include <stdio.h>
int main(){
    int n;
    scanf("%d", &n);
    printf("%d", n);
    return 0;
}

 

1011
#include <stdio.h>
int main(){
    char c;
    scanf("%c", &c);
    printf("%c", c);
    return 0;
}

 

1012
#include <stdio.h>
int main(){
    float f;
    scanf("%f", &f);
    printf("%f", f);
    return 0;
}

 

 

1013
#include <stdio.h>
int main(){
    int c1, c2;
    scanf("%d %d", &c1, &c2);
    printf("%d %d", c1,c2);
    return 0;
}

 

 

1014
#include <stdio.h>
int main(){
    char one, two;
    scanf("%c %c", &one, &two);
    printf("%c %c", two, one);
    return 0;
}

 

 

1015
#include <stdio.h>
int main(){
    float num;
    scanf("%f", &num);
    printf("%.2f", num);
    return 0;
}

 

 

1017
#include <stdio.h>
int main(){
    int num;
    scanf("%d", &num);
    printf("%d %d %d", num,num,num);
    return 0;
}

 

1018
#include <stdio.h>
int main(){
    int hour, minute;
    scanf("%d:%d", &hour, &minute);
    printf("%d:%d", hour, minute);
    return 0;
}

 

 

1019
#include <stdio.h>
int main(){
    int y, m, d;
    scanf("%d.%d.%d", &y, &m, &d);
    printf("%04d.%02d.%02d", y,m,d);
    return 0;
}

 

1020
#include <stdio.h>
int main(){
    int f, b;
    scanf("%d-%d", &f,&b);
    printf("%06d%07d", f,b);
    return 0;
}

 

1021 (ํฌ์ธํ„ฐ ์‚ฌ์šฉ)
#include <stdio.h>
#include <stdlib.h>

int main(){
    char *string = malloc(sizeof(char)*50);
    scanf("%s", string);
    printf("%s", string);
    free(string);
    return 0;
}

 

1022
#include <stdio.h>
#include <stdlib.h>

int main(){
    char *string = malloc(sizeof(char)*2001);
    scanf("%[^\n]s", string);
    printf("%s", string);
    free(string);
    return 0;
}

 

1023
#include <stdio.h>
#include <string.h>

int main(){
    char s1[30];
    scanf("%s", s1);
    char *ptr = strtok(s1, ".");

    while(ptr != NULL)
    {
        printf("%s\n", ptr);
        ptr = strtok(NULL, " ");
    }


    return 0;
}

 

 

1024
#include <stdio.h>

int main()
{
    char s1[30];
    scanf("%s", s1);
    for (int i = 0; s1[i] != NULL; i++){
        printf("\'%c\'\n", s1[i]);
    }
    return 0;
}

 

1025
#include <stdio.h> 

int main()
{
    int num;
    scanf("%d", &num);
    printf("[%d0000]\n", num / 10000);
    num %= 10000;
    printf("[%d000]\n", num / 1000);
    num %= 1000;
    printf("[%d00]\n", num / 100);
    num %= 100;
    printf("[%d0]\n", num / 10);
    num %= 10;
    printf("[%d]\n", num / 1);
}

 

 

1026
#include <stdio.h>

int main()
{
    int h, m, s;
    scanf("%d:%d:%d", &h, &m, &s);
    printf("%d", m);

}

 

 

1027

 

#include <stdio.h>

int main()
{
    int year, month, day;
    scanf("%d.%d.%d", &year, &month, &day);
    printf("%02d-%02d-%04d", day, month, year);
}

 

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.