wikioi 1276 图标的缩放


题目描述 Description

You have been asked to take a small icon that appears on the screen of a smart telephone and scale it up so it looks bigger on a regular computer screen.

你被要求把手机上的小图标变成电脑上的大的。

 

The icon will be encoded as characters (x and *) in a 3 × 3 grid as follows:

小图标是:


*x*

  xx

*  *
Write a program that accepts a positive integer scaling factor and outputs the scaled icon. A scaling factor of k means that each character is replaced by a k × k grid consisting only of that character.

写一个程序把它每一个字符都变成k*k的

输入描述 Input Description

The input will be a positive integer k such that k < 25.

输入会是一个正整数k,k<25。

输出描述 Output Description

The output will be 3k lines, which represent each individual line scaled by a factor of k and repeated k times. A line is scaled by a factor of k by replacing each character in the line with k copies of the character.

输出会是3k行,详见样例。

样例输入 Sample Input

3

样例输出 Sample Output

***xxx***

***xxx***

***xxx***

      xxxxxx

      xxxxxx

      xxxxxx
***     ***

***     ***

***     ***

数据范围及提示 Data Size & Hint

按照题目要求的缩进

#include<cstdio>
#include<cstdlib>

int main()
{
    int k;
    scanf("%d",&k);
    for(int j=0;j<k;j++)
    {
        for(int i=0;i<k;i++)
            printf("*");
        for(int i=0;i<k;i++)
            printf("x");
        for(int i=0;i<k;i++)
            printf("*");
        printf("\n");
    }
    for(int i=0;i<k;i++)
    {
        for(int m=0;m<k;m++)
            printf(" ");
        for(int j=0;j<k;j++)
            printf("xx");
        printf("\n");
    }
    for(int i=0;i<k;i++)
    {
        for(int j=0;j<k;j++)
            printf("*");
        printf(" ");
        for(int p=0;p<k-2;p++)
            printf(" ");
        for(int m=0;m<k;m++)
            printf("*");
        printf("\n");
    }
    return 0;
}

#include<cstdio>
#include<cstdlib>

char image[3][4]=
{
"*x*",
" xx",
"* *"
};

int main()
{
    int k;
    scanf("%d",&k);
    for(int i=0;i<3*k;i++)//3k*3k是宽*长,放大之前是3*3
    {
        for(int j=0;j<3*k;j++)
        {
            printf("%c",image[i/k][j/k]);
        }
        printf("\n");
    }
    return 0;
}


Apple Watch 的网格图标拖动缩放可以通过以下步骤实现: 1. 确定网格大小:首先,需要确定网格的大小,以便将图标放置在网格上。网格的大小应该适合 Apple Watch 的屏幕大小,并且应该能够容纳所需的图标数量。 2. 放置图标:然后,将图标放置在网格上。可以使用 Core Graphics 框架中的 UIImageView 类来实现此操作。将图标添加到 UIImageView 对象中,然后将 UIImageView 对象添加到网格的单元格中。 3. 监听手势事件:接下来,需要监听用户的手势事件,以便在用户拖动或缩放图标时进行相应的操作。可以使用 UIGestureRecognizer 类来实现此操作。将手势识别器添加到 UIImageView 对象中,并设置对应的代理方法,以便在手势发生时进行相应的操作。 4. 处理拖动事件:当用户拖动图标时,需要重新定位图标,并将其放置在新的单元格中。可以使用 UIImageView 对象的 frame 属性来实现此操作。将图标的坐标设置为手势事件的位置,然后对齐到最近的单元格。 5. 处理缩放事件:当用户缩放图标时,需要重新调整图标的大小,并将其放置在新的单元格中。可以使用 UIImageView 对象的 transform 属性来实现此操作。将图标的 transform 属性设置为 CGAffineTransformMakeScale 函数的返回值,以实现缩放效果。 通过以上步骤,可以实现 Apple Watch 的网格图标拖动缩放功能。这种功能可以提高用户的体验,使用户能够更加方便地使用 Apple Watch 上的应用程序和界面。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值