|
Revision 1, 0.7 kB
(checked in by pernet, 2 years ago)
|
|
Import de fflas-ffpack
|
| Line | |
|---|
| 1 | #include <stdlib.h> |
|---|
| 2 | #include <stdio.h> |
|---|
| 3 | #include <iostream> |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | template<class T> |
|---|
| 8 | T& myrand (T& r, long size) { |
|---|
| 9 | if (size < 0) |
|---|
| 10 | return r = T( (lrand48() % (-size-size)) + size ); |
|---|
| 11 | else |
|---|
| 12 | return r = T( lrand48() % size ) ; |
|---|
| 13 | }; |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | int main(int argc, char ** argv) { |
|---|
| 17 | |
|---|
| 18 | long ni=10,nj=10,max=100; |
|---|
| 19 | int offset = 0; |
|---|
| 20 | |
|---|
| 21 | if (argc > ++offset) |
|---|
| 22 | ni = atoi( argv[offset] ); |
|---|
| 23 | if (argc > ++offset) |
|---|
| 24 | nj = atoi( argv[offset] ); |
|---|
| 25 | if (argc > ++offset) |
|---|
| 26 | max = atoi( argv[offset] ); |
|---|
| 27 | |
|---|
| 28 | long tmp; |
|---|
| 29 | printf("%ld %ld M\n", ni, nj); |
|---|
| 30 | for (long i = 0; i < ni; ++i) |
|---|
| 31 | for (long j = 0; j < nj; ++j){ |
|---|
| 32 | printf("%ld %ld %ld\n", i+1, j+1, myrand(tmp, max)); |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | printf("0 0 0\n"); |
|---|
| 36 | |
|---|
| 37 | return 0; |
|---|
| 38 | } |
|---|