HDUOJ----A Computer Graphics Problem
2024-10-18 14:00:33
A Computer Graphics Problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 92 Accepted Submission(s): 80
Problem Description
In this problem we talk about the study of Computer Graphics. Of course, this is very, very hard. We have designed a new mobile phone, your task is to write a interface to display battery powers. Here we use '.' as empty grids. When the battery is empty, the interface will look like this:
*------------*
|............|
|............|
|............|
|............|
|............|
|............|
|............|
|............|
|............|
|............|
*------------*
When the battery is 60% full, the interface will look like this:
*------------*
|............|
|............|
|............|
|............|
|------------|
|------------|
|------------|
|------------|
|------------|
|------------|
*------------*
Each line there are 14 characters. Given the battery power the mobile phone left, say x%, your task is to output the corresponding interface. Here x will always be a multiple of 10, and never exceeds 100.
Input
The first line has a number T (T < 10) , indicating the number of test cases. For each test case there is a single line with a number x. (0 < x < 100, x is a multiple of 10)
Output
For test case X, output "Case #X:" at the first line. Then output the corresponding interface. See sample output for more details.
Sample Input
2
0
60
Sample Output
Case #1:
*------------*
|............|
|............|
|............|
|............|
|............|
|............|
|............|
|............|
|............|
|............|
*------------*
Case #2:
*------------*
|............|
|............|
|............|
|............|
|------------|
|------------|
|------------|
|------------|
|------------|
|------------|
*------------*
Source
简单题:
代码:
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int i,j,t,n,cnt;
scanf("%d",&t);
for(cnt=;cnt<=t;cnt++)
{
scanf("%d",&n);
printf("Case #%d:\n",cnt);
for(i=;i<;i++)
{
for(j=;j<;j++)
{
if(i==||i==)
{
if(j==||j==)
printf("*");
else
printf("-");
}
else
if(j==||j==)
printf("|");
else
if(i<=-n/)
printf(".");
else
printf("-");
}
puts("");
}
}
return ;
}
最新文章
- Ubuntu16.04 安装配置Caffe
- 在ScrollView下加入的组件,不能自动扩展到屏幕高度
- 基于eBox的LTC1446驱动
- 如何实现Qlikview的增量数据加载
- UWP开发入门(十四)—— UserControl中Adaptive UI的小技巧
- CentOs6.5中安装和配置vsftp
- CSharp使用log4net记录日志
- android项目中如何加载已有so库 <;转>;
- 第一章TP-Link 703N刷OpenWrt
- svn 清空
- ASP.NET MVC上传文件的几种方法
- Linux 程序设计的一些优化措施
- Arduino 串口篇 Arduino发送二进制 send binary via RS232-to-USB to PC
- 【Android Developers Training】 31. 序言:共享简单数据
- 网页设计——6.html其他标签
- Linux - gcc 的简易用法 (编译、参数与链结)
- Paint.FontMetrics
- pyinstaller
- java使用Iterator 迭代器
- Sqrt Bo (水题)