1566 - John

All about problems in Volume 15. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

1566 - John

Post by brianfry713 »

Use this thread to discuss this problem.
Check input and AC output for thousands of problems on uDebug!
metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 1566 - John

Post by metaphysis »

Test data generator.

Code: Select all

#include <ctime>
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    srand(time(NULL));
    int cases = 1000;
    cout << cases << '\n';
    for (int c = 1; c <= cases; c++)
    {
        int n = rand() % 47 + 1;
        cout << n << '\n';
        for (int i = 1; i <= n; i++)
        {
            int m = rand() % 4747 + 1;
            if (i > 1) cout << ' ';
            if (rand() % 1000 < 300) cout << 1;
            else cout << m;
        }
        cout << '\n';
    }
    return 0;
}
Post Reply

Return to “Volume 15 (1500-1599)”