cplib-cpp

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub hitonanode/cplib-cpp

:warning: 標準出力
(utilities/writer.hpp)

おまじないつきの std::cout 等より若干高速な整数標準出力.

Code

#pragma once
#include <cstdio>

template <typename T> void wt_integer(T x, char delim) {
    if (x == 0) {
        putchar('0'), putchar(delim);
        return;
    }
    if (x < 0) putchar('-'), x = -x;
    static char cache[20];
    char *head = cache;
    while (x) *head = '0' + x % 10, head++, x /= 10;
    while (head != cache) putchar(*(--head));
    putchar(delim);
}
#line 2 "utilities/writer.hpp"
#include <cstdio>

template <typename T> void wt_integer(T x, char delim) {
    if (x == 0) {
        putchar('0'), putchar(delim);
        return;
    }
    if (x < 0) putchar('-'), x = -x;
    static char cache[20];
    char *head = cache;
    while (x) *head = '0' + x % 10, head++, x /= 10;
    while (head != cache) putchar(*(--head));
    putchar(delim);
}
Back to top page