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

BlackShark What do you think about random? [1] // Problem 1082. Gaby Ivanushka 2 Apr 2009 20:28
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