poj3173
简单的考察输入输出的题。
View Code
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
//freopen("D:\\t.txt", "r", stdin);
int n, s;
scanf("%d%d", &n, &s);
s--;
for (int i = 1; i <= n; i++)
{
s += i;
int p = (s - 1) % 9;
if (i != 1)
for (int j = 0; j < (i - 1) * 2; j++)
printf(" ");
printf("%d", p + 1);
for (int j = i; j < n; j++)
{
p = (p + j) % 9;
printf(" %d", p + 1);
}
printf("\n");
}
}