Пример #1
0
int main(void)
{
struct stat instat;
struct stat outstat;

	if (stat(outfile, &outstat))
	{
		printf("names table missing\n");
		return gen_table();
	}
	
	if (stat(infile, &instat))
	{
		fprintf(stderr, "cannot stat '%s': error %d\n", infile, errno);
		return 1;
	}
	
	if (instat.st_mtime >= outstat.st_mtime)
	{
		return gen_table();
	}
	
	printf("table up to date\n");
	return 0;
}
Пример #2
0
int
main(int argc, char *argv[])
{
  struct braille_table_s table;
  gen_table(&table);
  braille_print(&table, "helloworld");
  return 0;
}
Пример #3
0
int main(int argc, char** argv) {
    gen_primes();
    gen_table();

    int cases = 0;
    scanf("%d", &cases);
    for (int i = 0; i < cases; ++i) {
        long long a, b;
        scanf("%lld %lld", &a, &b);
        printf("%lld\n", count_lucky(b) - count_lucky(a-1));
    }
    return 0;
}
Пример #4
0
/******************************************************************************
**  huffman_start
**  --------------------------------------------------------------------------
**  Starts Huffman encoding by writing Start of Image (SOI) and all headers.
**  Sets image size in Start of File (SOF) header before writing it.
**  
**  ARGUMENTS:
**      height  - image height (pixels);
**      width   - image width (pixels);
**	image_type_t - image type;
**	res - image resolution;
**
**  RETURN: -
******************************************************************************/
char huffman_start(short height, short width, image_type_t t, unsigned q_fctr)
{
    bitbuf.buf = 0;
    bitbuf.n = 0;
	huffman_ctx[2].dc =
	huffman_ctx[1].dc =
	huffman_ctx[0].dc = 0;

	//Generate the appropriate quantization table depending on selected compression level
	gen_table(q_fctr);
	huffman_ctx[0].qtable = q_table;

}