User 李世勛

Member for: 3 years (since Feb 25, 2021)
Type: Registered user
Student for 2020-2 C Programming
Full name:
Location:
Website:
About:

Activity by 李世勛

Score: -38 points (ranked #3,589)
Questions: 0
Answers: 69
Comments: 0
Voted on: 0 questions, 0 answers
Gave out: 0 up votes, 0 down votes
Received: 0 up votes, 0 down votes

Wall for 李世勛

#include<stdio.h>
#include<string.h>
int main(){
    char num[101] ;
    char *ptr = num ;
    scanf("%s" , ptr) ;
    
       for(int i = 0 ; i < strlen( ptr) ; i++){
           if(num[strlen( ptr) - 1] % 2 == 0){
               printf ("1 ") ;
               i = strlen( ptr) ;
           }else {
               printf ("0 ") ;
               i = strlen( ptr) ;
           }
       }
        
       int sum1 = 0 ;
    for(int i = 0 ; i < strlen( ptr) ; i++)
        sum1 += num[i] ;    
    for(int i = 0 ; i < strlen( ptr) ; i++)
        if (sum1 % 3 == 0){
               printf ("1 ") ;
               i = strlen( ptr) ;
        }else {
               printf ("0 ") ;
               i = strlen( ptr) ;
        }

       if((num[strlen(ptr)- 1]- 48) % 5 == 0){
           printf ("1 ") ;
    }else {
        printf ("0 ") ;
    }

    int sum2 = 0 , sum3 = 0 , judge ;
    if(strlen( ptr) % 2 == 0){
        for(int i = 0 ; i < strlen( ptr) / 2 ; i++)
            sum2 += (num[2 * i] - 48 ) ;
        for(int i = 0 ; i < strlen( ptr) / 2 ; i++)
            sum3 += (num[2 * i + 1] - 48) ;    
    }else{
        for(int i = 0 ; i < (strlen( ptr) - 1 ) / 2 ; i++)
        sum2 += (num[2 * i] - 48 );
        for(int i = 0 ; i < (strlen( ptr) + 1 ) / 2 ; i++)
        sum3 += (num[2 * i + 1] - 48) ;
    }
    if(sum3 > sum2)
        judge = (sum3 - sum2) % 11 ;    
    else
        judge = (sum2 - sum3) % 11 ;
    
    if(judge == 0)
           printf ("1") ;
    else
        printf ("0") ;
}
May 20, 2021 by 李世勛
#include <stdio.h>
#include <string.h>
int main() {
    char str1[101] , str2[101] ;
    scanf("%s", str1) ;
    scanf("%s", str2) ;
    
    int c[strlen(str1)] ;
    int i = 0 ;
    for(int i = 0 ; i < strlen(str1) ; i ++)
        if (str1[i] == str2[i]) {
            c[i] = 1 ;
            i ++ ;
        } else {
            c[i] = 0 ;
            i ++ ;
        }
    int a ;
    for(int i = 0 ; i < strlen(str1) ; i ++)
        a *= c[i] ;
    
    if(a == 0)
        printf("0") ;
    else
        printf("1") ;
}
May 14, 2021 by 李世勛
#include<stdio.h>
int gcd(int m, int n){
    while(n != 0) {
        int r = m % n;
        m = n;
        n = r;
    }
    return m;
}
int lcm(int m, int n){
    return m * n / gcd(m, n);
}
int lcm(int* a, int n){
    int l = *a;
    for(int i = 1; i < n; i ++)
        l = lcm(l, *(a + i));
    return l;
}
int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    for(int i = 0; i < n; i ++)
        scanf("%d", a + i);
    printf("%d", lcm(a, n));
}
May 14, 2021 by 李世勛
#include<stdio.h>
#include<string.h>
#define CODE 26
int main() {
    char word[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M'
                            ,'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'} ;
         
    char code[CODE][26] = {"-----","----+","---+-","--+--","-+---","---++","--+-+","-+--+","-+-+-",
                        "-++--","--+++","-+-++","-++-+","-+++-","-++++","+----","+---+","+--+-","+-+--","++---","+--++"
                        ,"+-+-+","++--+","++-+-","+++--","++++-"};  
    char *str ;    
    str = new char[50] ;      
    int str_len ;    
    scanf("%s" , str) ;

    str_len = strlen(str) ;  
    for (int i = 0 ; i <= str_len ; i++){
        for (int j = 0 ; j < 27 ; j++)
            if (str[i] = *code[j])
                str[i] = word[j] ;       
         printf("%s" , str[i]) ;     
    }  
}
May 10, 2021 by 李世勛
12,783 questions
183,443 answers
172,219 comments
4,824 users