【链接】 我是链接,点我呀:)
【题意】

题意

【题解】

https://blog.csdn.net/V5ZSQ/article/details/70873661
看这个人的吧。

【代码】

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 100;
const long long M = 15e6;int n,a,b,ans[N+10][N+10];
int kk = 0;int main(){ios::sync_with_stdio(0),cin.tie(0);cin >> n >> a >> b;if (n>a*b) {cout<<-1<<endl;return 0;}int cur = 0;if (b%2==1 || a==1){for (int i = 1;i <= a;i++)for (int j = 1;j <= b;j++){if (cur<n){ans[i][j] = ++cur;}else ans[i][j] = 0;}}else{for (int i = 1;i <= a;i++){if (i%2==1){for (int j = 1;j <= b;j++){if (cur<n){ans[i][j] = ++cur;}else ans[i][j] = 0;}}else{for (int j = b;j >= 1;j--){if (cur<n){ans[i][j] = ++cur;}else ans[i][j] = 0;}}}}for (int i = 1;i <= a;i++){for (int j = 1;j <= b;j++){cout<<ans[i][j]<<" ";}cout<<endl;}return 0;
}

转载于:https://www.cnblogs.com/AWCXV/p/10633957.html

【Codeforces 644A】Parliament of Berland相关推荐

  1. 【29.70%】【codeforces 723D】Lakes in Berland

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  2. 【Codeforces 723D】Lakes in Berland (dfs)

    海洋包围的小岛,岛内的有湖,'.'代表水,'*'代表陆地,给出的n*m的地图里至少有k个湖,求填掉面积尽量少的水,使得湖的数量正好为k. dfs找出所有水联通块,判断一下是否是湖(海水区非湖).将湖按 ...

  3. 【CodeForces - 144C】Anagram Search(尺取,滑窗问题,处理字符串计数)

    题干: A string t is called an anagram of the string s, if it is possible to rearrange letters in t so ...

  4. 【CodeForces - 574B】Bear and Three Musketeers (枚举边,思维,优秀暴力)

    题干: Do you know a story about the three musketeers? Anyway, you will learn about its origins now. Ri ...

  5. 【CodeForces - 608C】Chain Reaction (二分 或 dp ,思维)

    题干: 题目大意: 题意是在一条直线上坐落着不同位置的灯塔,每一个灯塔有自己的power level,当作是射程范围.现在从最右边的灯塔开始激发,如果左边的灯塔在这个灯塔的范围之内,那么将会被毁灭.否 ...

  6. 「一题多解」【CodeForces 85D】Sum of Medians(线段树 / 分块)

    题目链接 [CodeForces 85D]Sum of Medians 题目大意 实现一个setsetset,支持插入,删除,求∑a5k+3∑a5k+3\sum a_{5k+3}.注意,setsets ...

  7. 【CodeForces 997C】Sky Full of Stars(组合计数)

    题目链接:[CodeForces 997C]Sky Full of Stars 官方题解:Codeforces Round #493 - Editorial 题目大意:有一个n×nn×nn\times ...

  8. 【codeforces 812C】Sagheer and Nubian Market

    [题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...

  9. 【codeforces 508B】Anton and currency you all know

    [题目链接]:http://codeforces.com/contest/508/problem/B [题意] 给你一个奇数; 让你交换一次数字; 使得这个数字变成偶数; 要求偶数要最大; [题解] ...

最新文章

  1. 【题解】P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper
  2. weblogic管理2 - 创建并启动一个managed server
  3. 知识点讲解八:Python中的尾递归
  4. CodeForces - 236D Let‘s Play Osu!(概率dp)
  5. 赛尔号什么时候支持html5,赛尔号三全能时代即将来临 你准备好了吗
  6. python项目如何上线_django项目部署上线(示例代码)
  7. HTML5 Canvas操作图像像素
  8. 8种图数据库对 NULL 属性值支持情况
  9. json中含有Unicode的处理办法 C#
  10. 谷歌和 Zyxel 各修复一个已遭利用的 0day
  11. LaTeX tikz初探——空间矢量旋转示意图,四元数(4)
  12. 20190825 On Java8 第十二章 集合
  13. (二)win7下用Intelij IDEA 远程调试spark standalone 集群
  14. 服务器接口文档详细 接口文档模板 规范 完整
  15. 【云原生】—— 学习云计算应用开发你需要掌握的五大技能
  16. Highcharts翻译系列三:exporting导出和打印选项
  17. 超级计算机也无法算尽圆周率,圆周率到底能不能算尽?
  18. redis缓存失效时间设为多少_Redis缓存过期失效机制
  19. kestrel java_Kestrel Web 服务器学习笔记
  20. 倍投计算机器在线,2021看图开特马50研究计算倍投【欢迎你】

热门文章

  1. 基于Django框架的零食商城系统之Python毕设选题推荐
  2. TP全行业小程序运营管理系统源码+一键生成小程序
  3. 国家电网:企业数字化发展的“3-3-4”框架!
  4. idea插件,在idea中听云音乐
  5. NFC模块PN532使用
  6. 产销存报表直接在MB5B上取数
  7. js网页动画,如何做一款高逼格不失真的动画
  8. 基于STM32F103,用蜂鸣器播放歌曲
  9. 老杨说运维 | 农信行业运维数字化和智能化转型实践分享
  10. win7创建任务计划:自动关机命令