Pagini recente » Cod sursa (job #1461973) | Cod sursa (job #183221) | Cod sursa (job #1742806) | Cod sursa (job #1250479) | Cod sursa (job #2831805)
#include <iostream>
#include <fstream>
using namespace std;
const int BLOCKBITS = 7, BLOCKSIZE = 127, NRBLOCKS = 300, NMAX = 30000;
bool elim[NMAX];
int blocks[NRBLOCKS]
int getBlock(int pos);
int getFirst(int block);
int getLast(int block);
int rmv(int pos);
void initBlocks(int n);
int main()
{
int i, j, k, n, r, x, blockind, fpos, lpos, lastblock;
fin >> n;
j = 0;
for (i = 1; i <= n; i++) {
x = i % r;
while (x) {
blockind = getBlock(pos);
fpos = getFirst(blockind);
lpos = getLast(blockind);
while (x >= )
}
fout << j + 1 << " ";
r--;
}
return 0;
}
int getBlock(int pos) {
return pos >> BLOCKBITS;
}
int getFirst(int block) {
return block << BLOCKBITS;
}
int getLast(int block) {
return (block << BLOCKBITS) + BLOCKSIZE;
}
int rmv(int pos) {
int block = getBlock(pos);
blocks[block]--;
elim[pos] = 1;
}
void initBlocks(int n) {
int mxBlock = getBlock(n);
int i;
for (i = 0; i < mxBlock; i++)
blocks[i] = BLOCKSIZE + 1;
blocks[mxBlock] = n - (i << BLOCKBITS);
}