1、《信息学奥赛一本通 编程启蒙 C++版》 3001-3226
https://blog.csdn.net/dllglvzhenfeng/article/details/134910258
2、3227:【例38.1】 画出矩形
#include<bits/stdc++.h>
using namespace std;
int main()
{
int k,g,z,i,j,o,p,q=1,s=1;
char f;
cin>>g>>k>>f>>z;
if(z==1) //实心
{
for(i=1;i<=g;i++)
{
for(j=1;j<=k;j++)
{
cout<<f;
}
cout<<endl;
}
}
if(z==0) //0代表空心,1代表实心
{
for(o=1;o<=g;o++) //g:高 行数
{
//cout<<"o="<<o<<endl;
if(o==1||o==g)
{
p=1;
while(p<=k) //k:宽 列数
{
cout<<f;
p++;
}
cout<<endl;
}
else
{
for(q=1;q<=k;q++)
{
if(q==1||q==k) cout<<f;
else cout<<" ";
}
cout<<endl;
}
}
}
return 0;
}
3、3228:【例38.2】 图形输出
/*
3228:【例38.2】 图形输出
http://bas.ssoier.cn:8086/problem_show.php?pid=3228
用*输出菱形;
https://blog.csdn.net/m0_73551276/article/details/127385878
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
char A;
int a;
cin >> A >> a;
if(A=='Z'){
for(int i=0;i<a;i++){
for(int j=0;j<a;j++){
printf("*");
}
printf("\n");
}
}
else if(A=='L'){
for(int i=-a+1;i<a;i++){
for(int j=0;j<abs(i);j++) printf(" ");
for(int j=0;j<2*a-2*abs(i)-1;j++) printf("*");
printf("\n");
}
}
return 0;
}
4、3229:【例38.3】 X战警
/*
3229:【例38.3】 X战警
http://bas.ssoier.cn:8086/problem_show.php?pid=3229
https://blog.csdn.net/2301_77430037/article/details/131721377
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a=1,b=n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(j==a||j==b) cout<<'X';
else cout<<' ';
}
cout<<endl;
a++;
b--;
}
return 0;
}
5、3230:练38.1 宇宙大爆炸
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1;i<2*n;i++){
for(int j=1;j<2*n;j++){
cout<<"*";
}
cout<<endl;
}
return 0;
}
6、3231:练38.2 大写字母 Y
/*
3231:练38.2 大写字母 Y
http://bas.ssoier.cn:8086/problem_show.php?pid=3231
https://www.cnblogs.com/dks0313/p/16564641.html
*/
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int t=2*n-1;
for(int i=1;i<n;i++){
for(int j=1;j<=i-1;j++) cout<<" ";
for(int j=1;j<=t;j++){
if(j==1||j==t) cout<<"*";
else cout<<" ";
}
t-=2;
cout<<endl;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++)
if(j==n)cout<<"*";
else cout<<" ";
cout<<endl;
}
return 0;
}
7、3232:练38.3 空心菱形
P232 练38.3 空心菱形
/*
3232:练38.3 空心菱形
http://bas.ssoier.cn:8086/problem_show.php?pid=3232
*/
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
cin>>n;
for(int i=1;i<=n-1;i++)
{
cout<<' ';
}
cout<<'*'<<endl;
for(int i=2;i<=n;i++)
{
for(int j=1;j<=n-i;j++)
{
cout<<' ';
}
cout<<'*';
for(int j=1;j<=(i-1)*2-1;j++)
{
cout<<' ';
}
cout<<'*'<<endl;
}
for(int i=n-1;i>=2;i--)
{
for(int j=1;j<=n-i;j++)
{
cout<<' ';
}
cout<<'*';
for(int j=1;j<=(i-1)*2-1;j++)
{
cout<<' ';
}
cout<<'*'<<endl;
}
if( n>1 )
{
for(int i=1;i<=n-1;i++)
{
cout<<' ';
}
cout<<'*';
}
return 0;
}
8、3233:练38.4 金字塔
/*
3233:练38.4 金字塔
http://bas.ssoier.cn:8086/problem_show.php?pid=3233
https://blog.csdn.net/LCY20110310/article/details/130661108
*/
#include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n-i;j++){
cout<<' ';
}
cout<<'/';
for(int j=1;j<=2*(i-1);j++){
cout<<'_';
}
cout<<'\\'<<endl;
}
return 0;
}
9、3234:【例39.1】 鼓掌次数
#include<iostream>
using namespace std;
int main(){
long long n,k;
cin>>n>>k;
cout<<n/k;
return 0;
}
10、3235:【例39.2】 球弹跳高度的计算
[例 39.2] 球弹跳高度的计算
1085:球弹跳高度的计算
球弹跳高度计算
【一本通】1085 球弹跳高度的计算_哔哩哔哩_bilibili
1085:球弹跳高度的计算-信息学奥赛一本通_哔哩哔哩_bilibili
1085球弹跳高度的计算 信息学奥赛一本通解题第一部分C++语言基础_哔哩哔哩_bilibili
奥赛一本通循环结构题目精讲 1085 球弹跳高度的计算 1086 角谷猜想 1087 级数求和_哔哩哔哩_bilibili
信息学一本通1085:球弹跳高度的计算_哔哩哔哩_bilibili
/*
电子学会 C语言 1级 47 球弹跳高度的计算 02
1.5编程基础之循环控制 20:球弹跳高度的计算
http://noi.openjudge.cn/ch0105/20/
http://bailian.openjudge.cn/practice/3142/
1085:球弹跳高度的计算
http://ybt.ssoier.cn:8088/problem_show.php?pid=1085
*/
#include<iostream>
using namespace std;
int main(){
double hei, sum = 0;
cin >> hei;
for ( int i = 1; i <= 10; i++){
sum = sum + hei + hei / 2;
hei = hei / 2;
}
sum = sum - hei;
cout << sum << endl << hei;
return 0;
}
11、3236:练39.1 书香阁座位
第50课 书香阁的座位数
第50课 书香阁的座位数_书香阁一共有312个座位,已知第一排有15 个座位,以后每一排增加2个座位, 最后一排-CSDN博客
《小学生C++趣味编程》第50课 书香阁的座位数_数学计算
/*
试编一程序,
算一算书香阁最后一排有几个座位? 一共有几排?
312个
第1排 15个
15+2
.....
最后一排几个座位?
一共几排?
*/
#include<iostream>
using namespace std;
int main()
{
int sum,p,x;
//p排数
p=1;
//第1排 15个
x=15;
sum=x;
//cout<<p<<" "<<x;
//cout<<" "<<sum<<endl;
do
{
p++;
//每排增加2个座位
x+=2;
//前p排共有多少个座位
sum+=x;
//cout<<p<<" "<<x<<" "<<sum<<endl;
}while(sum!=312);
cout<<"最后一排的座位数:"<<x<<endl;
cout<<"排数:"<<p<<endl;
return 0;
}
/*
作业:
用for循环
while循环重写上面的程序
1089:数字反转
http://ybt.ssoier.cn:8088/problem_show.php?pid=1089
1090:含k个3的数
http://ybt.ssoier.cn:8088/problem_show.php?pid=1090
P4956 [COCI2017-2018#6] Davor
https://www.luogu.com.cn/problem/P4956
*/
12、3237:练39.2 蜗牛爬树
/*
第41课 蜗牛与葡萄树(完整)_2021.08.13(P169)
试编一程序,计算该蜗牛需要多少分钟才能爬到树顶。
树高:17分米
一步一步往上爬
每爬一分钟后休息1分钟
*/
#include<iostream>
using namespace std;
int main()
{
int i,t;
t=i=0;
while(1)
{
//爬1分钟
t++;
//每分钟爬3分米
i+=3;
if (i>=17) break;
//break跳出本层循环 这里跳出while循环
//休息1分钟
t++;
//下滑1分米
i--;
}
cout<<"需要"<<t<<"分钟"<<endl;
return 0;
}
/*
编译系统不做死循环的检查
NOI LINUX可以把整个系统删除
2022:【例4.7】最小n值
http://ybt.ssoier.cn:8088/problem_show.php?pid=2022
2023:【例4.8】数据统计
http://ybt.ssoier.cn:8088/problem_show.php?pid=2023
*/
13、3238:练39.3 鸡兔同笼
C++循环结构:鸡兔同笼问题
小讲堂第29课:C++鸡兔同笼问题
【例2.6】鸡兔同笼(信息学奥赛一本通-T2068)
《小学生C++趣味编程》第57课 鸡兔同笼_双重循环的应用
/*
鸡+兔=35
脚 94
*/
#include<iostream>
using namespace std;
int main()
{
int ji,tu;
for(ji=0;ji<=35;ji++)
for(tu=0;tu<=23;tu++)
{
if(ji+tu==35)
{
if(ji*2+tu*4==94)
{
cout<<"鸡:"<<ji<<" 兔:"<<tu<<endl;
}
}
}
return 0;
}
//作业:将代码自己打一遍,并调试运行。
/*
1092:求出e的值
http://ybt.ssoier.cn:8088/problem_show.php?pid=1092
1093:计算多项式的值
http://ybt.ssoier.cn:8088/problem_show.php?pid=1093
1094:与7无关的数
http://ybt.ssoier.cn:8088/problem_show.php?pid=1094
*/
14、3239:练39.4 百钱买百鸡
练 39.4 百钱买百鸡
2028:【例4.14】百钱买百鸡
C+2028百钱百鸡
【例4.14】百钱买百鸡(信息学奥赛一本通-T2028)_哔哩哔哩_bilibili
2028:【例4.14】百钱买百鸡_哔哩哔哩_bilibili
2028:【例4.14】百钱买百鸡-信息学奥赛一本通_哔哩哔哩_bilibili
第58课 百钱买百鸡 《小学生C++趣味编程》
第58课 百钱买百鸡(完整) 3.完善程序 (《小学生C++趣味编程》)
/*
第58课 百钱买百鸡(完整)
*/
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int gongji,muji,xiaoji;
cout<<setw(5)<<"公鸡"<<setw(5)<<"母鸡"<<setw(5)<<"小鸡"<<endl;
for(gongji=1;gongji<=33;gongji++)
for(muji=1;muji<=50;muji++)
{
xiaoji=100-gongji-muji;
//if( (gongji*3+muji*2+xiaoji/3==100) && (xiaoji%3==0))
if(gongji*3+muji*2+xiaoji*1.0/3.0==100)
cout<<setw(5)<<gongji<<setw(5)<<muji<<setw(5)<<xiaoji<<endl;
}
return 0;
}
//过一段时间把这道题目自己再重写一遍代码。
/*
1095:数1的个数
http://ybt.ssoier.cn:8088/problem_show.php?pid=1095
1096:数字统计
http://ybt.ssoier.cn:8088/problem_show.php?pid=1096
1097:画矩形
http://ybt.ssoier.cn:8088/problem_show.php?pid=1097
*/
15、3240:【例40.1】 字符类型判断
/*
3240:【例40.1】 字符类型判断
http://bas.ssoier.cn:8086/problem_show.php?pid=3240
*/
#include <bits/stdc++.h>
using namespace std;
int main( void )
{
char ch;
ch=getchar();
if( ch<='Z' && ch>='A')
{
cout<<"upper"<<endl;
return 0;
}
if( ch<='z' && ch>='a')
{
cout<<"lower"<<endl;
return 0;
}
if( ch<='9' && ch>='0')
{
cout<<"digit"<<endl;
return 0;
}
cout<<"other"<<endl;
return 0;
}



1、少儿编程(c++)解奥数题目(6集)
2、少儿编程(c++)少儿编程教育(56集)
3、每天五分钟学会C++(105集)
4、《小学生C++趣味编程》(11集)
5、少儿C++编程(26集)
6、精简版c++编程入门+配套练习(42集)
7、c++编程(11集)
8、小学生C++趣味编程(3集)
9、C++编程入门宝典:从零基础(4集)
10、从零开始学习C++编程(36集)
小学生讲C++(2023.12.03)
小学生适宜几年级开始学C++
宝宝的C++、小学生C++启蒙、小学生C++入门

2267

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



