Back
Close

A Babel of Languages on CodinGame

TBali
36.7K views

Objective-C

Objective-C

Checking the sample code

#include <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
    char m[101];
    scanf("%[^\n]", m);
    bool b[800];
    int blen = 0;
    for (int i = 0; i < strlen(m); i++)
    {
        int digit =  m[i];
        if (digit != 10)
            for (int j = 6; j >= 0; j--) {
                if ((digit >> j) & 1) {
                    b[blen++] = true;
                }
                else {
                    b[blen++] = false;
                }
            }
    }
    char a[2000];
    if (b[0])
        strcat(a, "0");
    else
        strcat(a, "00");
    strcat(a, " 0");
    for (int i = 1; i < blen; i++)
        if (b[i] == b[i - 1])
            strcat(a, "0");
        else
        {
            strcat(a, " ");
            if (b[i])
                strcat(a, "0");
            else
                strcat(a, "00");
            strcat(a, " 0");
        }
    printf([@"%s\n" UTF8String], a);
}
// To debug: fprintf(stderr, [@"Debug messages\n" UTF8String]);

Looking at the syntax

  • TODO

Other characteristics

  • TODO

Resources to check

Coming next...

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants