zoukankan      html  css  js  c++  java
  • poj1642

    简单题

    View Code
    #include <iostream>
    #include
    <cstdio>
    #include
    <cstdlib>
    #include
    <cstring>
    using namespace std;

    #define maxn 25

    int n;
    bool map[maxn][maxn][maxn];

    void input()
    {
    memset(map,
    0, sizeof(map));
    for (int i = 1; i <= n; i++)
    {
    int a;
    int j = 1;
    while (scanf("%d", &a), a)
    {
    for (int k = 1; k <= a; k++)
    map[i][j][k]
    = true;
    j
    ++;
    }
    }
    }

    void work()
    {
    int i, j, k;
    i
    = 1;
    while (map[1][1][i])
    {
    bool first = true;
    j
    = 1;
    while (map[j][1][i])
    {
    k
    = 1;
    while (map[j][k][i])
    k
    ++;
    k
    --;
    if (first)
    first
    = false;
    else
    putchar(
    ' ');
    printf(
    "%d", k);
    j
    ++;
    }
    i
    ++;
    putchar(
    '\n');
    }
    putchar(
    '\n');
    i
    = 1;
    while (map[1][i][1])
    {
    bool first = true;
    j
    = 1;
    while (map[1][i][j])
    {
    k
    = 1;
    while (map[k][i][j])
    k
    ++;
    k
    --;
    if (first)
    first
    = false;
    else
    putchar(
    ' ');
    printf(
    "%d", k);
    j
    ++;
    }
    i
    ++;
    putchar(
    '\n');
    }
    putchar(
    '\n');
    }

    int main()
    {
    //freopen("t.txt", "r", stdin);
    bool first = true;
    while (scanf("%d", &n), n)
    {
    if (first)
    first
    = false;
    else
    putchar(
    '\n');
    input();
    work();
    }
    return 0;
    }
  • 相关阅读:
    Codeforces Round #439 (Div. 2)
    Money Systems
    Stamps
    inflate
    多重背包问题
    AIM Tech Round 4 (Div. 2)
    September Challenge 2017
    树的重心
    百度之星2017初赛A
    树上的最大独立集
  • 原文地址:https://www.cnblogs.com/rainydays/p/2147765.html
Copyright © 2011-2022 走看看