【常用】namespace bikuhiku

2022/6/4 23:21:31

本文主要是介绍【常用】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));
}


这篇关于【常用】namespace bikuhiku的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程