bmeonline Contest1000 做题记录

A

image

直接写即可

点击查看代码
#include <bits/stdc++.h>
using namespace std;

namespace steven24 {
	
void main() {
	int a, b;
	cin >> a >> b;
	cout << a + b << "\n";
}	
	
}

int main() {
	ios::sync_with_stdio(false);
	steven24::main();
	return 0;
}
/*
3 5
*/

B

image

注意一下用浮点数算即可

点击查看代码
#include <bits/stdc++.h>
#define db double
using namespace std;

namespace steven24 {
	
void main() {
	db c;
	cin >> c;
	db f = 32 + c * 1.8;
	cout << f << "\n";
}	
	
}

int main() {
	ios::sync_with_stdio(false);
	steven24::main();
	return 0;
}
/*
50
*/

C

image

直接算即可,记得用浮点数

点击查看代码
#include <bits/stdc++.h>
#define db double
using namespace std;

namespace steven24 {
	
void main() {
	db s, h;
	cin >> s >> h;
	cout << s * h / 2 << "\n";
}	
	
}

int main() {
	ios::sync_with_stdio(false);
	steven24::main();
	return 0;
}
/*
1.2 3.4
*/

D

image

几个参数别弄混,记得用浮点算即可

点击查看代码
#include <bits/stdc++.h>
#define db double
using namespace std;
const db pi = 3.14;

namespace steven24 {
	
void main() {
	db h, r;
	cin >> h >> r;
	db V, C, Sd, Sc, Sz;
	C = 2 * pi * r;
	Sd = pi * pow(r, 2);
	V = Sd * h;
	Sc = h * C;
	Sz = Sc + 2 * Sd;
	cout << V << " " << Sc << " " << Sz << "\n";
}	
	
}

int main() {
	ios::sync_with_stdio(false);
	steven24::main();
	return 0;
}
/*
3 4
*/

E

image

需要海伦公式:
\(S = \sqrt{p(p-a)(p-b)(p-c)}\), 其中 \(p = \frac{a+b+c}{2}\)

点击查看代码
#include <bits/stdc++.h>
#define db double
using namespace std;
const db pi = 3.14;

namespace steven24 {
	
void main() {
	db a, b, c, p;
	cin >> a >> b >> c;
	p = (a + b + c) / 2;
	db S = sqrt(p * (p - a) * (p - b) * (p - c));
	cout << S << "\n";
}	
	
}

int main() {
	ios::sync_with_stdio(false);
	steven24::main();
	return 0;
}
/*
3 4 5
*/

F

image

模运算教学局,但是可以用 char 逃课()

点击查看代码
#include <bits/stdc++.h>
using namespace std;

namespace steven24 {

char s[6];
	
void main() {
	for (int i = 1; i <= 3; ++i) s[i] =getchar();
	for (int i = 3; i; --i) cout << s[i];
}	
	
}

int main() {
	ios::sync_with_stdio(false);
	steven24::main();
	return 0;
}
/*
123
*/
posted @ 2025-10-09 14:10  Steven24  阅读(12)  评论(0)    收藏  举报