前言
整体评价
这相当于蓝桥云课 正式推出算法赛前的公测,主要面向的是大一新生。
比赛题还是以语法题为主,被戏称为"幼稚园杯",^_^。
链接:新生编程排位赛1
A. 妮妮的蓝桥果园
Q: n 个蓝桥果,减去a个,加上b个,最后剩几个?
#include <iostream>
using namespace std;
int main()
{
int n, a, b;
cin >> n >> a >> b;
cout << (n - a + b) << endl;
return 0;
}
B. 蓝桥语学习
Q: 给你一个字符串s,如果末尾字符为‘s',则添加‘es’,如果不是’s‘, 则添加’s‘
简化版的单数形态转复数形态
#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
if (s[s.length() - 1] == 's') {
cout << s + "es" << endl;
} else {
cout << s + "s" << endl;
}
return 0;
}
C. 小蓝的能源挑战
Q: 一度电可以5公里,x度电是否可以到达y公里的目的地?
这题引入了多case的模式
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t-- > 0) {
int x, y;
cin >> x >> y;
if (x * 5 >= y) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}
D. 小蓝的积分冒险
Q: 三种任务分别奖励4,2,0,求这些任务总共的奖励值
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t-- > 0) {
int x, y, z;
cin >> x >> y >> z;
cout << (4 * x + 2 * y) << endl;
}
return 0;
}
E. 小蓝的甜点选择
Q: 小桥和小依都卖甜点,哪个价格划算,就输出对方的名字
这题有个小插曲,就是描述和答案恰好相反,而已答案比的那个价格更贵(而不是划算)
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t-- > 0) {
int x, y;
cin >> x >> y;
if (x == y) cout << "ANY" << endl;
else if (x > y) cout << "BRIDGE" << endl;
else cout << "YI" << endl;
}
return 0;
}