Thanks mmonish. I want to chat with you. My id = cse0304003@yahoo.com
Thanks again.
10164 - Number Game
Moderator: Board moderators
Re: 10164 - Number Game
I must be tired or something, but I don't understand how the backtracking works here.
How should it handle inputs like this one:
?
How should it handle inputs like this one:
Code: Select all
512
513 2 2 ... 2 2 1 1 ... 1 1 (511 2's and 511 1's)
0
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 10164 - Number Game
Test data generator.
Code: Select all
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[])
{
srand(time(NULL));
int N[10] = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024};
for (int cases = 1; cases <= 100; cases++)
{
int n = N[rand() % 10];
cout << n << '\n';
for (int i = 0; i < (2 * n - 1); i++)
{
if (i) cout << ' ';
cout << (rand() % 1000 + 1);
}
cout << '\n';
}
cout << "0\n";
return 0;
}
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.