Search found 6 matches
- Sun Feb 22, 2004 3:53 am
- Forum: Volume 1 (100-199)
- Topic: 101 - The Blocks Problem
- Replies: 635
- Views: 56144
My new code is below. [cpp]#include <iostream> #include <vector> using namespace std; class Blocks { typedef vector<unsigned short> cvectype; vector<cvectype> vec; class block_pos { public: unsigned short row; unsigned short column; block_pos(unsigned short r, unsigned short c):row(r), column(c){} }...
- Sun Feb 22, 2004 3:51 am
- Forum: Volume 1 (100-199)
- Topic: 101 - The Blocks Problem
- Replies: 635
- Views: 56144
- Sat Feb 21, 2004 6:16 am
- Forum: Volume 1 (100-199)
- Topic: 101 - The Blocks Problem
- Replies: 635
- Views: 56144
101 Compile Error.
I use gcc 3.2.2, and compiled it successfully. [cpp]#include <iostream> #include <vector> using namespace std; class Blocks { typedef vector<short> cvectype; vector<cvectype> vec; class block_pos { public: short row; short column; block_pos(short r, short c):row(r), column(c){} }; block_pos block_fi...
- Sun Feb 15, 2004 5:30 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 212758
I think C++ is more powerful than C in this problem. [cpp]#include <iostream> using namespace std; typedef struct cycle { int i, j, maxcycle; struct cycle *next; }LIST; unsigned int findmaxcycle(unsigned int min, unsigned int max) { register unsigned int n, counter, k, maxcycle; maxcycle = 0; counte...
- Sun Feb 15, 2004 4:48 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 212758
- Sat Feb 14, 2004 4:29 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 212758
My code has got LT. Why? [c]#include <stdio.h> unsigned int findmaxcycle(unsigned int i, unsigned int j) { register unsigned int n, counter, min, max, k, p; static cycles[999999]; counter = 1; k = 1; if (i > j) {min = j; max = i;} else {min = i; max = j;} for (k = min; k <= max; k++) { n = k; while ...