蓝桥杯
helloworld
blue_mmxx
这个作者很懒,什么都没留下…
展开
-
第十届蓝桥杯b组
组队 490 每次选这一列最高的,如果最高的球员已经选择了就选择第二高的以此类推,计算五列 17 20 15 11 18 98 99 98 97 98 得到答案490 年号字串 #include<iostream> #include<string> #include<stack> using namespace std; stack<int> ans; int main(){ int num=2019; int shang=0; int原创 2021-03-22 20:01:05 · 115 阅读 · 0 评论 -
第十届蓝桥杯c组
求和 1905111 这里的string::npos可以使用-1代替 #include<iostream> #include<string> using namespace std; int main(){ long long ans=0; for(int i=1;i<=2019;i++){ string str=to_string(i); if(str.find("2")!= string::npos||str.find("0"原创 2021-03-19 18:07:34 · 187 阅读 · 0 评论 -
第十一届蓝桥杯c++b组
门牌制作 结果624 #include<iostream> using namespace std; int ans=0; void count(int num){ while(num){ if(num%10==2) ans++; num/=10; } } int main(){ for(int i=1;i<=2020;i++) count(i); cout<<ans<<endl; return 0; } 既约分数原创 2021-03-18 20:50:18 · 314 阅读 · 0 评论 -
蓝桥杯蛇行矩阵
蛇形矩阵是由1开始的自然数依次排列成的一个矩阵上三角形。 输入 本题有多组数据,每组数据由一个正整数N组成。(N不大于100) 输出 对于每一组数据,输出一个N行的蛇形矩阵。两组输出之间不要额外的空行。矩阵三角中同一行的数字用一个空格分开。行尾不要多余的空格。 样例输入 5 样例输出 1 3 6 10 15 2 5 9 14 4 8 13 7 12 11 #include<iostream> using namespace std; int main(){ int num; ci原创 2021-03-11 21:19:44 · 132 阅读 · 0 评论 -
蓝桥杯Minesweeper
题目描述 Minesweeper Have you ever played Minesweeper? This cute little game comes with a certain operating system whose name we can’t remember. The goal of the game is to find where all the mines are located within a M x N field. The game shows a number in a原创 2021-03-11 20:51:55 · 169 阅读 · 0 评论 -
蓝桥杯字符串的输入输出处理
字符串的输入输出处理。 输入 第一行是一个正整数N,最大为100。之后是多行字符串(行数大于N), 每一行字符串可能含有空格,字符数不超过1000。 输出 先将输入中的前N行字符串(可能含有空格)原样输出,再将余下的字符串(不含有空格)以空格或回车分割依次按行输出。每行输出之间输出一个空行。 样例输入 2 www.dotcpp.com DOTCPP A C M D O T CPP 样例输出 www.dotcpp.com DOTCPP A C M D O T CPP #include<iostream&原创 2021-03-11 19:58:11 · 307 阅读 · 0 评论 -
蓝桥杯字符逆序
将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。 #include<iostream> #include<string> using namespace std; int main() { string str; getline(cin,str); for(int i=str.size()-1;i>=0;i--){ cout<<str[i]; } cout<<endl; return 0; } ...原创 2021-03-11 19:30:32 · 99 阅读 · 0 评论 -
蓝桥杯用筛法求之N内的素数
题目描述 用筛法求之N内的素数。 输入 N #include<iostream> #include<cmath> using namespace std; int main() { int num; cin>>num; for(int i=2;i<=num;i++){ int end=sqrt(i); int flag=1; for(int j=2;j<=end;j++){ if(i%j==0)原创 2021-03-11 19:26:52 · 67 阅读 · 0 评论 -
蓝桥杯helloworld
#include<iostream> #include<vector> using namespace std; int main() { int num; vector<int> nums; while(cin>>num){ nums.push_back(num); } for(auto &&i:nums) printf("%c",i); cout<<e原创 2021-03-11 19:12:37 · 99 阅读 · 0 评论 -
蓝桥杯核桃的数量
小张是软件项目经理,他带领3个开发组。工期紧,今天都在加班呢。为鼓舞士气,小张打算给每个组发一袋核桃(据传言能补脑)。他的要求是: 各组的核桃数量必须相同 各组内必须能平分核桃(当然是不能打碎的) 尽量提供满足1,2条件的最小数量(节约闹革命嘛) 输入 输入包含三个正整数a, b, c,表示每个组正在加班的人数,用空格分开(a,b,c< 30) 输出 输出一个正整数,表示每袋核桃的数量。 样例输入 2 4 5 样例输出 20 #include<iostream> #include&原创 2021-03-11 18:58:04 · 107 阅读 · 0 评论