00-熟悉环境

表面积计算

cpp
#include <bits/stdc++.h>
#define _endl "\n"
using namespace std;

void solve()
{
	int a, b, c;	
  	cin >> a >> b >> c;
	cout << 2 * ((a * b) + (a * c) + (b * c)) << _endl;
}

int main()
{
	int t;	cin >> t;
	while (t --)	solve();
	return 0;
}

表达式求值

cpp
#include <bits/stdc++.h>
#define _endl "\n"
using namespace std;

void solve()
{
	int a, b, c;	cin >> a >> b >> c;
	cout << (a + b > c && b == c) << _endl;
}

int main()
{
	int t;	cin >> t;
	while (t--)	solve();
	return 0;
}

nn 的阶乘

cpp
#include <bits/stdc++.h>
#define _endl "\n"
using namespace std;

void solve()
{
	auto fact = [&](auto self, int x) -> long long
	{
		if (!x)	return 1;
		return x * self(self, x - 1) * 1LL;
	};

	int n;	cin >> n;
	cout << fact(fact, n);
}

int main()
{
	solve();
	return 0;
}

成绩评定

cpp
#include <bits/stdc++.h>
#define _endl "\n"
using namespace std;

void solve()
{
	double n;	cin >> n;
	if (n >= 85)	cout << 'A';
	else if (n >= 75) cout << 'B';
	else if (n >= 65)	cout << 'C';
	else if (n >= 60)	cout << 'D';
	else	cout << 'F';
	cout << _endl;
}

int main()
{
	int t;	cin >> t;
	while (t--)	solve();
	return 0;
}

超重青蛙

cpp
#include <bits/stdc++.h>
#define int long long
#define all(x) (x).begin(), (x).end()
#define _endl "\n"
using namespace std;

void solve()
{
	int n, cnt = 0;	cin >> n;
	vector<int> v(n);
	for (auto& x : v)	cin >> x;
	double avg = accumulate(all(v), 0ll) * 1.0 / n;
	for (auto x : v)	cnt += x > avg;
	cout << cnt << _endl;
}

signed main()
{
	int t;	cin >> t;
	while (t --)	solve();
	return 0;
}
🚀 深入理解 C++20 bit:现代位操作的终极指南