2 Star 5 Fork 0

webturing/ACM_ahstu2024

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.cpp 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
webturing 提交于 2024-04-07 10:57 . ACM实用模板
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <functional>
#include <queue>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#ifndef TEST
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> piii;
// fast input
inline ll read() {
ll X = 0, w = 0;
char ch = 0;
while (!isdigit(ch)) {
w |= ch == '-';
ch = getchar();
}
while (isdigit(ch))
X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
return w ? -X : X;
}
// fast output
inline void write(ll x) {
if (x < 0)
putchar('-'), x = -x;
if (x > 9)
write(x / 10);
putchar(x % 10 + '0');
}
#define pb push_back
#define mp make_pair
void solve() {
}
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
/**
这段代码中 fin 是一个 ifstream 类型的对象,用于读取文件 test.in。当打开文件成功,即文件存在且可读时,可以将它作为标准输入流,这可以通过以下语句实现:
cin.rdbuf(fin.rdbuf());
这行代码是将标准输入流 cin 的缓冲区(即键盘输入)由原来的指向控制台(默认情况下)改为指向文件 C.in 的输入流 fin。这样一来,程序在执行输入操作时将从文件 C.in 中读取数据而非键盘输入。
使用这种技巧可以帮助我们更加方便地进行本地测试,将输入数据替换为文件,而不是每次手动输入数据
*/
ifstream fin("test.in");
if (fin.good()) {
cin.rdbuf(fin.rdbuf());
}
int t = 1;
while (t--) {
solve();
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/webturing/acm2023.git
git@gitee.com:webturing/acm2023.git
webturing
acm2023
ACM_ahstu2024
master

搜索帮助