114232024-09-15 13:16:07CsongiKiváló Számokcpp17Runtime error 33/10064ms1680 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    //ifstream cin("input.txt");
    int n;
    cin >> n;
    if (n < 3)
    {
        cout << 15 << endl;
    }
    else
    {
        if (n % 3 == 0)
        {
            for (int i = 0; i < n; i++)
            {
                cout << 1;
            }
            cout << endl;
        }
        else if (n % 3 == 1)
        {
            string m = "";
            for (int i = 0; i < n; i++)
            {
                m += '1';
            }
            
            int i = m.size() - 1;
            while (stoi(m) % 3 != 0)
            {
                m[i] = '5';
                i--;
            }
            cout << m << endl;
        }
        else
        {
            string m = "";
            for (int i = 0; i < n; i++)
            {
                m += '1';
            }
            
            int i = m.size() - 1;
            while (stoi(m) % 3 != 0)
            {
                m[i] = '5';
                i--;
            }
            cout << m << endl;
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted2ms360 KiB
subtask233/33
2Accepted3ms360 KiB
3Accepted3ms360 KiB
4Accepted3ms488 KiB
5Accepted3ms360 KiB
6Accepted2ms384 KiB
7Accepted2ms360 KiB
8Accepted3ms376 KiB
subtask30/33
9Accepted17ms660 KiB
10Runtime error8ms1076 KiB
11Accepted39ms1000 KiB
12Runtime error8ms1156 KiB
13Runtime error8ms1428 KiB
14Runtime error7ms904 KiB
15Runtime error6ms744 KiB
16Accepted17ms616 KiB
17Accepted27ms744 KiB
18Runtime error8ms1536 KiB
19Runtime error6ms888 KiB
20Runtime error8ms1412 KiB
subtask40/34
21Runtime error10ms1564 KiB
22Runtime error7ms920 KiB
23Runtime error9ms1568 KiB
24Accepted64ms1384 KiB
25Accepted50ms1128 KiB
26Accepted28ms732 KiB
27Runtime error10ms1488 KiB
28Runtime error9ms1680 KiB
29Runtime error6ms772 KiB
30Runtime error8ms1428 KiB
31Runtime error8ms1412 KiB
32Runtime error4ms616 KiB
33Accepted8ms504 KiB