

正文
总共8道题。
A. 握手问题(填空题)
【题目】握手问题
【分析】
纯考察数学中简单排列组合。考虑相互握手的43人:(43 * 42) / 2;考虑剩下7人与43人分别握手:7 * 43;两者相加即最终答案。
【答案】1204
【AC_Code】
#include <iostream>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void solve() {
cout << 1204 << '\n'; }
int main() {
IOS; solve(); return 0; }
B. 小球反弹(填空题)
【题目】小球反弹
【分析】
考察高中简单物理思维。小球从左上角出发最终回到左上角,说明水平和竖直位移分别是长和宽的偶数倍。又速率之比为位移之比(15:17),可写双重循环控制总过程中长和宽的倍数暴力求解即可。
【答案】1100325199.77
【AC_Code】
#include <iostream>
#include <iomanip>
#include <cmath>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e4;
int L = 343720, W = 233333;
int solve()
{
for (int i = 2; i <= N; i += 2) for (int j = 2; j <= N; j += 2)
{
if (L * i * 17 == W * j * 15)
{
cout << fixed << setprecision(2) << sqrt(pow(L * i, 2) + pow(W * j, 2)) << '\n';
return 0;
}
}
}
int main() {
IOS; solve(); }
C. 好数
【题目】好数
【分析】
考察模拟。写一个check函数判断是否为好数:逆向思维 ①奇数位为偶数时,返回false;②偶数位为奇数时返回false;①②包含了不满足的所有情况,都不满足最后返回true。其中digit(位数)的使用很关键(在check函数开头设置为1,否则可能会错误累加),还有不要出现悬空else的情况。
【AC_Code】
#include <iostream>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int n, cnt, digit;
bool check(int i)
{
digit = 1;
while (i)
{
if (digit % 2 == 1) {
if ((i % 10) % 2 == 0) return false; }
else if ((i % 10) % 2 != 0) return false;
digit ++
第15届蓝桥杯软件赛CB组省赛题目分析

最低0.47元/天 解锁文章
4639

被折叠的 条评论
为什么被折叠?



