답안 #685257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
685257 2023-01-23T19:17:37 Z heeheeheehaaw Costinland (info1cup19_costinland) C++17
63.589 / 100
1 ms 340 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

char a[1005][1005];

signed main()
{
    int k, n, putere = 1;
    cin>>k;
    int l = ceil(log2(k)) + 1;
    for(int i = 1; i <= l + 1; i++)
        for(int j = 1; j <= l + 1; j++)
            a[i][j] = '.';
    for(int i = 0; i < 100; i++)
    {
        if(k == 0)
            break;
        n = i + 1;
        if((k & (putere))!=0)
        {
            k -= putere;
            if(k > 0)
            {
                a[i+1][i+1] = 'X';
                a[i+1][i+2] = 'X';
                a[i+2][i+1] = 'r';
            }
            putere *= 2;
        }
        else
        {
            a[i+1][i+1] = 'X';
            a[i+1][i+2] = 'd';
            a[i+2][i+1] = 'r';
            putere = putere * 2;
        }
    }

    n++;
    for(int i = 1; i <= n; i++)
    {
        a[n][i] = 'r';
        a[i][n] = 'd';
    }
    a[n][n] = '.';

    cout<<n<<" "<<n<<'\n';
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
            cout<<(char)a[i][j];
        cout<<'\n';
    }

    return 0;
}

Compilation message

costinland.cpp: In function 'int main()':
costinland.cpp:10:12: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
   10 |     int k, n, putere = 1;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Correct! Your size: 3
2 Correct 1 ms 212 KB Correct! Your size: 4
3 Correct 1 ms 212 KB Correct! Your size: 4
4 Correct 1 ms 212 KB Correct! Your size: 4
5 Correct 1 ms 232 KB Correct! Your size: 4
6 Correct 1 ms 212 KB Correct! Your size: 5
7 Correct 0 ms 212 KB Correct! Your size: 5
8 Correct 1 ms 304 KB Correct! Your size: 5
9 Partially correct 1 ms 212 KB Partially Correct! Your size: 6
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 340 KB Partially Correct! Your size: 60
2 Partially correct 1 ms 340 KB Partially Correct! Your size: 60
3 Partially correct 1 ms 308 KB Partially Correct! Your size: 61
4 Partially correct 1 ms 340 KB Partially Correct! Your size: 61
5 Partially correct 1 ms 340 KB Partially Correct! Your size: 61
6 Partially correct 1 ms 340 KB Partially Correct! Your size: 61
7 Partially correct 1 ms 308 KB Partially Correct! Your size: 61
8 Partially correct 1 ms 340 KB Partially Correct! Your size: 59