贪心算法,每条路径最短2格,故前k-1步每次走2格,最后一步全走完

由于数据比较小,可以先打表

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std; typedef pair<int,int> Point; int main(){
int n, m, k, flag = -;
cin >> n >> m >>k;
vector<Point> table;
for(int i = ; i < n ; ++i){
flag*=-;
for(int j = ; j < m; ++ j){
table.push_back(Point(i,flag> ? j : (m--j)));
}
}
for(int i = ; i <*(k -); i+=){
cout<<<<" "<<table[i].first+<<" "<<table[i].second+<<" "<<table[i+].first+<<" "<<table[i+].second+<<endl;
}
cout<<m*n-*(k-);
for(int i = *(k-); i < m*n; ++ i ){
cout<<" "<<table[i].first+<<" "<<table[i].second+;
}
cout<<endl;
}

关于额外的信息, |xi - xi + 1| + |yi - yi + 1| = 1,其实就是一个点的四连通区域,即上下左右4个点

codeforces Round #252 (Div. 2) C - Valera and Tubes的更多相关文章

  1. Codeforces Round #252 (Div. 2) B. Valera and Fruits(模拟)

    B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. Codeforces Round #252 (Div. 2) B. Valera and Fruits

    #include <iostream> #include <vector> #include <algorithm> #include <map> us ...

  3. Codeforces Round #252 (Div. 2) A - Valera and Antique Items

    水题 #include <iostream> #include <set> #include <vector> #include <algorithm> ...

  4. Codeforces Round #252 (Div. 2) 441B. Valera and Fruits

    英语不好就是坑啊.这道题把我坑残了啊.5次WA一次被HACK.第二题得分就比第一题高10分啊. 以后一定要加强英语的学习,要不然就跪了. 题意:有一个果园里有非常多树,上面有非常多果实,为了不然成熟的 ...

  5. Codeforces Round 252 (Div. 2)

    layout: post title: Codeforces Round 252 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  6. [Codeforces Round #237 (Div. 2)] A. Valera and X

    A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  7. Codeforces Round #216 (Div. 2) D. Valera and Fools

    题目链接:http://codeforces.com/contest/369/problem/D 注意题意:所有fools都向编号最小的fool开枪:但每个fool都不会笨到想自己开枪,所以编号最小的 ...

  8. Codeforces Round #252 (Div. 2) D

    http://codeforces.com/problemset/problem/441/D 置换群的基本问题,一个轮换内交换成正常顺序需要k-1次,k为轮换内元素个数 两个轮换之间交换元素,可以把两 ...

  9. Codeforces Round #216 (Div. 2) B. Valera and Contest

    #include <iostream> #include <algorithm> #include <vector> using namespace std; in ...

随机推荐

  1. Python内置的HTTP协议服务器SimpleHTTPServer

    [root@ok 6FE5-D831]# python -m SimpleHTTPServer 一条命令,HTTP服务就搭起来了!!! 方便朋友下载,自己的文件!!

  2. jquery学习笔记-----插件开发的编写总结

    一.对jQuery对象的扩展 ;(function($){ $.fn.extend(  { fun1:abc,fun2:1bc … } ) })(jQuery) 这里采用立即执行模式,即不用调用也能执 ...

  3. MVC部分视图(Partial View)

    分部视图,也就是整体视图的一部分.单个视图页面展示在整体页面之上,使用步骤如下 1.创建视图数据也就是viewmodel public class FooterViewModel { public s ...

  4. HTML CSS微信CSS显示一些总结

    微信显示网页是调用腾讯自带的浏览器内核,由于腾讯浏览器内核对css展示效果没有谷歌浏览器好,导致用谷歌浏览器写好的网页,放到微信页面之后,显示的效果就发生变化,所以调整css样式显得那么吃力: 1. ...

  5. struts标签<logic:iterate>的用法

    <logic:iterate>主要用来处理在页面上输出集合类,集合一般来说是下列之一: 1. java对象的数组 2. ArrayList.Vector.HashMap等 具体用法请参考s ...

  6. JavaScript - 变量,作用域,内存

    JavaScript 变量可以用来保存两种类型的值:基本类型值和应用类型值.基本类型的值源自以下5种基本数据类型:Undefined.Null.Bollean.Number和String. 所有变量都 ...

  7. android 入门-工序

    页面: 1.启动页 2.引导页 3.主页面 自定义控件: 轮播控件 轮播列表控件 弹出控件 加载控件 引导页控件 下拉刷新 上拉加载控件

  8. VS2015上又一必备免费插件:Refactoring Essentials

    (此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:Refactoring Essentials是一款用于代码分析和重构的开源免费VS20 ...

  9. linux ssh key配置方法

    转自:http://blog.csdn.net/zzk197/article/details/7915307 一:简洁的配置文件[root@cisco ~]# vi /etc/ssh/sshd_con ...

  10. bat学习

    http://www.cnblogs.com/gaohongchen01/p/4042047.html http://www.cnblogs.com/amylis_chen/p/3585339.htm ...