Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我wa了N久,最后写个随机数生成器,再找个ac代码,才把bug找出来。。。

Posted by sicojuy at 2011-03-15 20:32:35 on Problem 1088 and last updated at 2011-03-15 20:33:03
In Reply To:谁能告诉这段代码为什么错了?自己运动结果正常,为什么submit就wrong result呢 Posted by:zhuyunxiang1984 at 2011-02-03 23:46:42
//get random numbers
#include <iostream>
#include <ctime>
#include <fstream>
#include <cstdlib>
using namespace std;

int main()
{
	int i, j;
	int r, c;
    ofstream f("rand_num.txt", ios::out | ios::trunc);
    if(!f.is_open())
    {
        cout << "Can not open file!\n";
        return 1;
    }
    srand(time(NULL));
	r = rand() % 10 + 1;
	c = rand() % 10 + 1;
	f << r << ' ' << c << endl;
    for(i = 0; i < r; ++i)
	{
	  for(j = 0; j < c; ++j)
		f << rand() % 100 << ' ';
	  f << endl;
	}
	f.close();
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator