PersonalCorpus 版 (精华区)

寄信人: sino (茶水)
标  题: 488
发信站: 哈工大紫丁香 (2002年06月16日18:35:15 星期天)
来  源: 202.118.239.224 

Your C++ program has solved Ok the problem 488 (Triangle Wave)
in 0.010 seconds with low memory spent.

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <ctype.h>

void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\uva\\input488.txt","r",stdin);
    freopen("c:\\uva\\output488.txt","w",stdout);
#endif

    int n,a,b,i,j,k;

    scanf("%d\n",&n);
    while (n>0) {
        n--;
        scanf("%d\n",&a); scanf("%d\n",&b);
        while (b>0) {
            b--;
            for (i=1;i<=a;i++) {
                for (j=0;j<i;j++) printf("%d",i);
                printf("\n");
            }
            for (i=a-1;i>0;i--) {
                for (j=0;j<i;j++) printf("%d",i);
                printf("\n");
            }
            if (b>0) printf("\n");
        }
//        if (n>0) printf("\n");
        printf("\n");
    }
}


--
SecureNetTerm can be dowloaded to all countries except
Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria.

※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.239.224]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.100毫秒