Skip to the content.

A. Bad Ugly Numbers

Link

Solution

一道很好玩的题,标答是n为1时不存在,否则输出233…3。不过我是输出9999…4或7,反正也过了,虽然不知道怎么证正确性,但样例都过了那就是过了

Code

int main(int argc, char **argv) {
    int n, t;
    cin >> t;
    while (t--) {
        cin >> n;
        if (n == 1) { cout << -1 << endl; continue; }
        for (int i = 0; i < n - 1; i++)cout << 9;
        if (n % 4 == 0)cout << 7;
        else cout << 4;
        cout << endl;
    }
    return 0;
}