Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

快乐地水一水

Posted by wxfwxf328 at 2012-02-06 12:33:17 on Problem 3173
#include<iostream>
#include<cstring>
using namespace std;
char a[30][30];
int main()
{
    int n,s;
    while(cin>>n>>s)
    {
        memset(a,' ',sizeof(a));s+=48;
        for(int i=0;i<n;i++)
            for(int j=0;j<=i;j++)
                a[j][i]=s,s=s==57?49:s+1;
        for(int i=0,k=s;i<n;i++)
            for(int j=0;j<n;j++)
                cout<<a[i][j]<<(j==n-1?'\n':' ');
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator