2654 - 吴壕的电池
吴壕的手机电池可高端了。但是呢。吴壕有点2,他想知道自己手机剩下这些电的时候手机电池是怎么显示的,但是他自己不会,所以来问你们了。
Input
多组输入,每组数据包含一个数n(n一定是10的倍数且不超过100)
Output
输出吴壕手机是怎么显示的。
每组数据后输出一个空行。
Examples
Input
0 60
Output
*------------* |............| |............| |............| |............| |............| |............| |............| |............| |............| |............| *------------* *------------* |............| |............| |............| |............| |------------| |------------| |------------| |------------| |------------| |------------| *------------*
Solution C
#include<stdio.h> int main() { int n; while(scanf("%d",&n)!=EOF) { int i,j,k; i=n/10; j=10-i; printf("*------------*\n"); for(k=0;k<j;k++) printf("|............|\n"); for(k=0;k<i;k++) printf("|------------|\n"); printf("*------------*\n\n"); } }
Solution C++
#include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> using namespace std; int main() { int t,x; int i; while(scanf("%d",&x)!=EOF) { printf("*------------*\n"); for(i=0;i<10-x/10;i++) printf("|............|\n"); for(i=0;i<x/10;i++) printf("|------------|\n"); printf("*------------*\n"); printf("\n"); } return 0; }