
C++
XJTU_Gary
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
倒三角C++算法实现
问题描述 输入N,打印N层倒三角 算法实现 #include<iostream> using namespace std; int main(){ int n; cin>>n; if(n>20) return 0; for(int i=0;i<n;i++){ for(int j=0;j<2*n-i-1;j++){ if(j<...原创 2019-12-29 00:22:17 · 715 阅读 · 0 评论 -
韩信点兵C++算法实现
问题描述 今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问物几何?这个问题就是韩信点兵. 算法实现 #include<iostream> using namespace std; int main(){ int a,b,c; cin>>a>>b>>c; for(int i=10;i<=100;i++){ if((i-a...原创 2019-12-29 00:18:33 · 2694 阅读 · 1 评论 -
C++水仙花数
问题描述 输出所有的“水仙花数”,所谓的“水仙花数”是指一个三位数其各位数字的立方和等于该数本身,例如153是“水仙花数”,因为:153 = 13 + 53 + 33。 算法设计 #include<iostream> using namespace std; int main(){ for(int i=1;i<10;i++){ for(int j=0;j<10;j...原创 2019-12-28 23:16:58 · 1092 阅读 · 1 评论 -
C++ 实现break跳出嵌套多层循环
QUESTION C++ does not provide a mechanism for jumping out of multiple loops,but we need use it sometimes. SOLUTION In order to solve it,we can do this using tag bits. For example: Given an array of in...原创 2019-12-24 09:49:00 · 2552 阅读 · 0 评论