Problem D: 零起点学算法95——弓型矩阵
#include<stdio.h>
#include<string.h>
int main()
{
int n,m,a[][];
while(scanf("%d%d",&n,&m)!=EOF)
{ int t,i,j;
t=a[i=][j=]=;
while(t<n*m)
{
while(j+<m)
a[i][++j]=++t;
a[++i][j]=++t;
while(j->=)
a[i][--j]=++t;
a[++i][j]=++t;
} for(int i=;i<n;i++)
{
for(int j=;j<m-;j++)
{
printf("%2d ",a[i][j]);
}
printf("%2d\n",a[i][m-]);
}
} return ;
}
Problem D: 零起点学算法95——弓型矩阵的更多相关文章
- 武汉科技大学ACM :1009: 零起点学算法63——弓型矩阵
Problem Description 输出n*m的弓型矩阵 Input 多组测试数据 每组输入2个整数 n和m(不大于20) Output 输出n*m的弓型矩阵,要求左上角元素是1,(每个元素占2个 ...
- Problem D: 零起点学算法94——输出矩阵
#include<stdio.h> int main() { ][]; while(scanf("%d %d",&n,&m)!=EOF) { ; ;i& ...
- Problem H: 零起点学算法109——单数变复数
#include <stdio.h> #include<string.h> int main(void) { int n; ]; scanf("%d",&a ...
- Problem G: 零起点学算法106——首字母变大写
#include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- Problem E: 零起点学算法34——3n+1问题
#include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...
- Problem K: 零起点学算法107——统计元音
#include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...
- Problem J: 零起点学算法105——C语言合法标识符
#include<stdio.h> #include<ctype.h>//调用isalpha函数 int main() { int n; ]; while(scanf(&quo ...
- Problem I: 零起点学算法104——Yes,I can!
#include<stdio.h> int main() { ]; while(gets(a)!=NULL) { printf("I am "); printf(&qu ...
随机推荐
- spring-retry 重试机制
业务场景 应用中需要实现一个功能: 需要将数据上传到远程存储服务,同时在返回处理成功情况下做其他操作.这个功能不复杂,分为两个步骤:第一步调用远程的Rest服务逻辑包装给处理方法返回处理结果:第二步拿 ...
- RabbitMQ 基础知识
1. 背景 RabbitMQ 是一个由 erlang 开发的AMQP 开源实现,erlang语言天生具备高并发的特性,而且他的管理界面用起来十分方便. 基础概念 讲解基础概念的前面,我们先来整体构造一 ...
- jq监听ajax执行开始,出错,结束。
$(“#msg”).ajaxComplete(function(event,request, settings){ $(this).append(“<li>请求完成.</li&g ...
- leetcode 之Swap Nodes in Pairs(21)
不允许通过值来交换,在更新指针时需要小心. ListNode *swapNodes(ListNode* head) { ListNode dummy(-); dummy.next = head; fo ...
- js刷新页面代码
第一种: location.reload() 第二种: location.replace(location.href) 第三种: history.go() 第四种: location=location ...
- 小程序css
样式导入 @import /** common.wxss **/ .small-p { padding:5px; } /** app.wxss **/ @import "common.wxs ...
- AIOps实践三板斧:从可视化、自动化到智能化
http://ai.51cto.com/art/201806/576881.htm?mobile
- Bootstrap新版里的a标签点击后出现下划线解决办法
其实我从失去焦点后发现了下划线消失了就应该知道 Bootstrap对a标签进行了 focus焦点事件. 所以解决办法就是一句:a:focus{text-decoration: none}. 一个笑笑的 ...
- margin和spacing的区别
margin指的是与边框间的距离. spacing指的是组件间的距离
- mysql 允许远程IP连接, 并查看所有用户的所有权限
添加mysql用户 http://my.oschina.net/u/1179414/blog/202377 允许远程ip连接 GRANT select,insert,update,delete ON ...