Loading... ![GTR](https://tony102.com/usr/uploads/2021/10/1229064234.jpg) ## 特性介绍 Engine Model: VR38DETT 年度迭代升级,主要在以下方面做出更新: 1. 新增支持常用数据类型:`char` 数组,以及浮点型 2. 扩大 `bufl = 1 << 20` ,防止部分 RE 情况 3. 常数优化,增强易用性 ## 源代码 ```cpp namespace GTR { const int bufl = 1 << 15; char buf[bufl], *s = buf, *t = buf; inline int fetch() { if (s == t) { t = (s = buf) + fread(buf, 1, bufl, stdin); if (s == t) return EOF; } return *s++; } inline int read() { int a = 0, b = 1, c = fetch(); while (c < 48 || c > 57) b ^= c == '-', c = fetch(); while (c >= 48 && c <= 57) a = (a << 1) + (a << 3) + c - 48, c = fetch(); return b ? a : -a; } inline double readLf() { int b = 1, c = fetch(); double a = 0.00; while (c < 48 || c > 57) b ^= c == '-', c = fetch(); while (c >= 48 && c <= 57) a = a * 10.00 + c - 48, c = fetch(); if (c == '.') { c = fetch(); double t = 1.00; while (c >= 48 && c <= 57) a = a * 10.00 + c - 48, c = fetch(), t *= 10.000; a /= t; } return b ? a : -a; } inline int readStr(char *s) { int n = 0; char c; for (n = 1; (c = fetch()) != '\n' && c != ' ' && c != EOF; ++ n) s[n] = c; return n - 1; } } using GTR::read; ``` ## 20211026 中期改款 Engine Model: VR46DETT ### 新增特性 **增加 `template` 模板类功能,支持整形读入自定义数据类型(`int`/`long long`)** 此外建议一般情况下将 `bufl` 调成 `1 << 15` ### 源代码 ```cpp namespace GTR { const int bufl = 1 << 15; char buf[bufl], *s = buf, *t = buf; inline int fetch() { if (s == t) { t = (s = buf) + fread(buf, 1, bufl, stdin); if (s == t) return EOF; } return *s++; } template < class T > inline T read() { T a = 0, b = 1, c = fetch(); while (c < 48 || c > 57) b ^= c == '-', c = fetch(); while (c >= 48 && c <= 57) a = (a << 1) + (a << 3) + c - 48, c = fetch(); return b ? a : -a; } } using GTR::read; ``` 最后修改:2021 年 10 月 26 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏