ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1082. Gaby Ivanushka

What do you think about random?
Posted by BlackShark 2 Apr 2009 20:28
Re: What do you think about random?
Posted by AleRD 10 Sep 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