Home  >  Article  >  Web Front-end  >  Codeforces(441B) Round #252 (Div. 2)_html/css_WEB-ITnose

Codeforces(441B) Round #252 (Div. 2)_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:03:141068browse

题目链接:http://codeforces.com/contest/441/problem/C

题目大意:有一个n*m的矩阵,你需要用k根管道填满这个矩形,管道只能横着或者直着放,不能斜着放。让你每行输出管道的经过点的坐标。因为有很多种放置方法,所以只需要输出满足条件的任意一种就行。

由于n,?m,?k (2?≤?n,?m?≤?300; 2?≤?2k?≤?n·m) ,所以前面k-1根管道只需要占据两个点,最后一根管道蛇形轨迹即可,这样所有的情况都能满足。

#include <iostream>#include <cstdio>#define MAX_N 300using namespace std;int main(){        #ifndef ONLINE_JUDGE            freopen("D:/out.txt","w",stdout);    #endif  //ONLINE_JUDGE    int n,m,k;    scanf("%d%d%d",&n,&m,&k);    int i=1;    int j=1;    bool s=true;    for(int p=1;p<k printf for t="1;t<=2;t++)" if s="true;" else j j-->=1;j--)                    printf("%d %d ",i+1,j);            }            j++;        }        else        {            for(;j>=1;j--)            {                printf("%d %d ",i,j);            }            j++;            if(i<n for printf j-- return>  <br>  <br>  <p></p> </n></k></cstdio></iostream>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn