feat: basic fast io for C++
This commit is contained in:
parent
dbb92ac9eb
commit
3cd582c6e8
2 changed files with 22 additions and 2 deletions
22
cpp/a.cpp
22
cpp/a.cpp
|
@ -4,9 +4,29 @@
|
||||||
#pragma GCC optimize("Ofast")
|
#pragma GCC optimize("Ofast")
|
||||||
#pragma GCC optimization("unroll-loops")
|
#pragma GCC optimization("unroll-loops")
|
||||||
|
|
||||||
|
#define N 3
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
cout << "Hello, C++!\n";
|
// faster IO
|
||||||
|
ios::sync_with_stdio(false);
|
||||||
|
cin.tie(NULL);
|
||||||
|
|
||||||
|
int sum = 0;
|
||||||
|
int nums[N];
|
||||||
|
|
||||||
|
for (int i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
cin >> nums[i];
|
||||||
|
sum += nums[i];
|
||||||
|
|
||||||
|
cout << nums[i];
|
||||||
|
|
||||||
|
if (i < N - 1)
|
||||||
|
cout << " + ";
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << " = " << sum << "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
./cpp/a < ./input.txt
|
./cpp/a < ./input.txt
|
||||||
|
|
||||||
@bench-cpp: build-cpp
|
@bench-cpp: build-cpp
|
||||||
hyperfine './cpp/a < ./input.txt'
|
hyperfine './cpp/a < ./input.txt'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue