|
|
вернуться в форумWhat do you think about random? Re: What do you think about random? Послано AleRD 10 сен 2010 00:59 Tell me please, why my C++ code has WRONG ANSWER 1 #include <iostream> #include <set> using namespace std; int main() { int N; cin>>N; srand((int)__TIME__); set <int> arr; while (arr.size()!=N) { int temp = rand()%(N+1); if (arr.find(temp)==arr.end() && temp!=0) { cout<<temp<<" "; arr.insert(temp); } } return 0; } it is not standart solution, but it is right |
|
|