1. 程式人生 > >卡常數技巧整合

卡常數技巧整合

inline pos turn 整理 urn 常數 整合 span bool

整理一些不太過分的卡常數技巧

1.bzoj4574 ZJOI2016:確定數據不會爆longlong的情況下把所有東西都開成longlong最後取模

2.O2下取模優化(一堆題)

inline int inc(int x,int v,int mod){x+=v;return x>=mod?x-mod:x;}//代替取模+
inline int dec(int x,int v,int mod){x-=v;return x<0?x+mod:x;}//代替取模-

3.前置++

4.不要開bool 開char/int

卡常數技巧整合