其他分享
首页 > 其他分享> > 【常用】namespace bikuhiku

【常用】namespace bikuhiku

作者:互联网

#include <stdio.h>
#include <map>
#include <time.h>
#include <iostream>
namespace bikuhiku {
	
	signed bikuhiku_signal;
    char bikuhiku_temp_char;
    long long bikuhiku_count;
    #define _sg bikuhiku_signal
    #define _tc bikuhiku_temp_char
    #define _ct bikuhiku_count
    
    //These functions are used to judge the type of char;
	bool Digit(char _target) {
        if(_target >= '0'&&_target <= '9') return true;
        return false;
    }
    bool Break(char _target) {
        if(_target == 10) return false;
        if(_target == 32) return false;
        return _target;
    }
    bool Little(char _target) {
        if(_target >= 'a'&&_target <= 'z') 
            return true;
        return false;
    }
    bool Great(char _target) {
        if(_target >= 'A'&&_target <= 'Z') 
            return true;
        return false;
    }
    int allType(char _target) {
        if(_target == 32) return 0;
        if(_target == 10) return 10;
        if(Digit(_target)) return 1;
        if(Little(_target)) return 2;
        if(Great(_target)) return 3;
        return 4;
    }
    
    //These functions are used to input;
    int get_str(char *_aim) {
        _ct = 0;
        _tc = getchar();
        for(;Break(_tc);_tc = getchar()) 
            _aim[_ct++] = _tc;
        _aim[_ct] = 0;
        return _tc;
    }
    int get_line(char *_aim) {
        _ct = 0;
        _tc = getchar();
        for(;Break(_tc)|(_tc == 32);_tc = getchar()) 
            _aim[_ct++] = _tc;
        _aim[_ct] = 0;
        return _tc;
    }
    int get_int() {
    	int _aim = 0;
    	_sg = 1, _tc = getchar();
    	for(;!Digit(_tc);_tc = getchar()) {
    		if(_tc == '-') _sg = -1;
    		if(_tc == 0) return 0;
		}
		for(;Digit(_tc);_tc = getchar()) 
			_aim = (_aim<<1)+(_aim<<3)+_tc-'0';
		_aim *= _sg;
		return _aim;
	}
	template <typename Tec> 
    int get_int(Tec &_aim) {
        _aim = 0, _sg = 1;
        _tc = getchar();
        for(;!Digit(_tc);_tc = getchar()) {
            if(_tc == '-') _sg = -1;
            if(_tc == 0) return 0;
        }
        for(;Digit(_tc);_tc = getchar()) 
            _aim = (_aim<<1)+(_aim<<3)+_tc-'0';
        _aim *= _sg;
        return 1;
    }
    template <typename Tec> 
    int format_get_int(Tec &_aim,Tec _length) {
        _aim = 0, _sg = 1;
        _tc = getchar();
        for(;!Digit(_tc);_tc = getchar()) {
            if(_tc == '-') _sg = -1;
            if(_tc == 0) return 0;
        }
        for(;Digit(_tc);_tc = getchar(),--_length) {
            _aim = (_aim<<1)+(_aim<<3)+_tc-'0';
            if(_length == 1) 
                break;
        }
        _aim *= _sg;
        return 1;
    }
    template <typename Tec,typename ...Args>
    inline void get_int(Tec &aim,Args &...args) {
        get_int(aim);
        get_int(args...);
    }
    
    //These functions are used to output;
    template <typename Tec>
    void put_int(Tec contents) {
        if(contents > 9) put_int(contents/10);
        putchar(contents%10+48);
    }
    template <typename Tec,typename ...Args>
    inline void put_int(Tec &aim,Args &...args) {
        put_int(aim);
        put_int(args...);
    }
    
    //These functions are used to realise something about math;
	template <typename Tec> 
    Tec max(Tec comp_x,Tec comp_y) {
        return comp_x > comp_y ? comp_x : comp_y;
    }
    template <typename Tec>
    Tec min(Tec comp_x,Tec comp_y) {
        return comp_x < comp_y ? comp_x : comp_y;
    }
    template <typename Tec>
    Tec abs(Tec _aim) {
    	return _aim > 0 ? _aim : -_aim;
	}
    
    //
    int randline[10] = {2,7,1,3,4,8,0,9,5,6};
    int randprime[6] = {13,37,51,31,19,17};
    template <typename Tec>
    Tec Brand(Tec _seed) {
    	clock();
    	Tec _aim = 0;
    	while(_seed < 1000000) 
    		_seed *= randprime[(clock()&time(0))%6];
    	while(_seed >= 1000000) 
    		_seed >>= 1;
    	while(_seed) {
    		_aim = (_aim*10)+randline[_seed%10];
    		_seed /= 10;
		}
		return _aim;
	}
} using namespace bikuhiku;
signed main() {
	printf("%d",Brand(2));
}

标签:常用,int,comp,Tec,namespace,bikuhiku,aim,tc
来源: https://www.cnblogs.com/bikuhiku/p/16342941.html