HDU 4716 A Computer Graphics Problem(模拟啊 )

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4716

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

2013 ACM/ICPC Asia Regional Online —— Warmup2

代码如下:

#include <stdio.h>
#include <string.h>
int main()
{
    int t,i,j,n,cas=1;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        char mp[20][20]= {"*------------*",
                          "|............|",
                          "|............|",
                          "|............|",
                          "|............|",
                          "|............|",
                          "|............|",
                          "|............|",
                          "|............|",
                          "|............|",
                          "|............|",
                          "*------------*"
                         };
        n/=10;
        for(i=1; i<=n; i++)
        {
            for(j=1; j<=12; j++)
                mp[11-i][j]='-';
        }
        printf("Case #%d:\n",cas++);
        for(i=0; i<12; i++)
        {
            for(j=0; j<14; j++)
            {
                printf("%c",mp[i][j]);
            }
            printf("\n");
        }
    }
    return 0;
}
时间: 2024-11-05 13:26:43

HDU 4716 A Computer Graphics Problem(模拟啊 )的相关文章

水题 HDOJ 4716 A Computer Graphics Problem

题目传送门 1 /* 2 水题:看见x是十的倍数就简单了 3 */ 4 #include <cstdio> 5 #include <iostream> 6 #include <algorithm> 7 #include <cstring> 8 #include <string> 9 #include <cmath> 10 using namespace std; 11 12 const int MAXN = 1e4 + 10; 13

HDU 4974 A simple water problem 模拟(水

水题. #include <cstdio> #include <iostream> #include <queue> #include <algorithm> using namespace std; typedef long long ll; priority_queue<int> q; int main() { int T, cas = 0; scanf("%d", &T); while(T-- > 0) {

A Computer Graphics Problem 4176 2013上海邀请赛

A Computer Graphics Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 968    Accepted Submission(s): 688 Problem Description In this problem we talk about the study of Computer Graphics.

HDU ACM 2522 A simple problem 模拟除法

分析:在除的过程中,当出现相同余数时即出现循环节. #include<iostream> using namespace std; bool h[100002]; void div(int x) { int t; memset(h,false,x*sizeof(h[0])+1); h[1]=true; t=1; while(t) { t=t*10; cout<<t/x; t=t%x; if(h[t]) //再次出现相同余数,表示出现循环节 break; h[t]=true; } }

hdu 5640 King&#39;s Cake(模拟)

Problem Description It is the king's birthday before the military parade . The ministers prepared a rectangle cake of size n×m(1≤n,m≤10000) . The king plans to cut the cake himself. But he has a strange habit of cutting cakes. Each time, he will cut

hdu 4930 Fighting the Landlords (模拟)

Fighting the Landlords Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 160    Accepted Submission(s): 52 Problem Description Fighting the Landlords is a card game which has been a heat for ye

hdu 5615 Jam&#39;s math problem(十字相乘判定)

d. Jam有道数学题想向你请教一下,他刚刚学会因式分解比如说,x^2+6x+5=(x+1)(x+5) 就好像形如 ax^2+bx+c => pqx^2+(qk+mp)x+km=(px+k)(qx+m) 但是他很蠢,他只会做p,q,m,kp,q,m,k为正整数的题目 请你帮助他,问可不可以分解 题意就是问一个一元二次方程能不能进行十字相乘的分解? s. 官方题解:第一道题比较简单,可以说是简单的模拟题,我们考虑到a,b,c都是10^9??的,所以我们决定要把时间复杂度降下来, 对于每一个数,因为

hdu 5323 Solve this interesting problem(dfs)

题目链接:hdu 5323 Solve this interesting problem 逆向思维,每次向左或向右翻倍,知道左端点为0时,即恰好满足的情况,处理处所有情况去取最小值. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; const ll inf = 0x3f3f3f3f; ll L, R, N; void

hdu 4974 A simple water problem(数学题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4974 Problem Description Dragon is watching competitions on TV. Every competition is held between two competitors, and surely Dragon's favorite. After each competition he will give a score of either 0 or