1 solutions

  • 0
    @ 2025-3-3 16:33:48

    C :

    #include <stdio.h>
    int main(void)
    {
    long int a,b,c,t=10,i=0;
    scanf("%ld=%ld",&a,&c);
    while (a/t)
    {
    b=a%t;
    if (a/t+b==c) {
    printf("%ld+%ld=%ld\n",a/t,b,c);
    t*=10;i++;
    }
    else t*=10;
    }
    if (i==0) puts("Impossible!");
    return 0;
    }
    

    Python :

    a,b=input().split("=")
    n=len(a)
    for i in range(1,n):
        if int(a[0:i])+int(a[i:n])==int(b):
            print ("%s+%s=%s"%(a[0:i],a[i:n],b))
            break
    else:
        print("Impossible!")
    
    • 1

    Information

    ID
    10717
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By