Luke'family
来源:互联网 发布:dota2天梯淘宝买账号 编辑:程序博客网 时间:2024/05/01 07:22
Luke's family
TimeLimit:
Totalsubmit:
Description
In the stars’ family, Luke only has seen his father andgrandfather. He really wants to know what his ancestors look like.We numbered Luke as the No.0 star. Luke’s father is No.1 star, andthe father of Luke’s father is No.2 star, and so on.Luke looks like:
*
Luke’s father looks like:
* * * *
* * * *
* * * * * * *
* * * * * * *
Input
There are multiple test cases.In each test case, the first line is an integer n(1<=n<=90).
Output
For each test case, first output a line “Case T:” T starts with 1.And then output what the No.n star looks like.Sample Input
0
1
2
3
Sample Output
Case 1:
*
Case 2:
* * * *
* * * *
Case 3:
* * * * * * *
* * * * * * *
Case 4:
* * * * * * * * * *
* * * * * * * * * *
Source
Luke
#include<iostream>#include<stdio.h>#include<algorithm>#include<string>#include<string.h>#include<stdlib.h>#include<math.h>using namespacestd;int main(){ int n,i,j,k,s,t,T=1; while(~scanf("%d",&n)){ printf("Case%d:\n",T++); if(n==0) printf("*\n"); else { s=3*n; for(i=0;i<n;i++){ s--; for (j=0;j<s; j++) printf(""); for (k=0; k<2*i+2;k++) { if(k%2) printf("*"); else printf(" "); } printf("\n"); } t=-1; s=3*n+1; for (i=0; i<n+1; i++) { t++; for (k=0; k<t; k++) printf(""); for (j=i; j<s; j++){ if(j==i) printf("*"); else printf(" *"); } printf("\n"); } t=n; s=2*n+1; for (i=0; i<n; i++) { t--; s++; for (k=0; k<t; k++) { printf(""); } for (j=0; j<s; j++) { if(j==0) printf("*"); else printf(" *"); } printf("\n"); } s=2*n; for(i=n;i>0;i--){ s++; for (j=0;j<s-1; j++) printf(""); for (k=2*i; k>0; k--) { if(k%2) printf("*"); else printf(" "); } printf("\n"); } } } return 0;}
0 0
- Luke'family
- Luke
- Luke
- FAMILY
- family
- Family
- luke使用
- Luke使用
- Save Luke
- lucene辅助工具luke
- 关于Luke的介绍
- Luke安装与使用
- luke最新版本
- 【Lucene教程】Luke
- 10-luke介绍
- Luke for Lucene5.2.0
- A. Save Luke
- CF624A - Save Luke
- 剪枝问题
- VS2010/MFC编程入门之十一(对话框:非模态对话框的创建及显示)
- 普通母函数
- Dijkstra算法
- 二分图——匈牙利算法
- Luke'family
- 结构体排序
- linux磁盘管理二之磁盘配额
- 2072Count(foj)
- 1002 hdu (高精度)
- Common Subsequence(hdu 1159)
- 最长公共子序列
- Dijkstra算法(单源最短路径)
- hdu(Number Sequence 1711)kmp