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 ...
随机推荐
- 禁用 Cortana 的解决办法
1. GPedit.msc 2. 然后在本地组策略编辑器中,点击“用户配置”中的“管理模版”,接着双击右侧的“Windows 组件”. 3. 下拉滚动条,并找到“文件资源管理器”,双击进入. 找到“在 ...
- 写个dump_stack【转】
转自:http://blog.chinaunix.net/uid-27714502-id-3434761.html 简单实现dump_stack 0.首先确保你能写个内核模块:打印"hell ...
- charger related source code position
Platform Qualcomm MSM8917 or MSM8937 Source kernel/msm-3.18/drivers/power/qpnp-smbcharger.c kernel/m ...
- eComStation 1.2
https://thomas0008.ctfile.com/u/75519/87485 https://thomas0008.ctfile.com/downhtml/75519/428846/1508 ...
- tomcat修改内存
windows: 修改bin/catalina.bat, 第一行添加 set JAVA_OPTS=-Xms256m -Xmx512m linux: 修改bin/catalina.sh 第一行添加 JA ...
- Codeforces 873B - Balanced Substring(思维)
题目链接:http://codeforces.com/problemset/problem/873/B 题目大意:一个字符串全部由‘0’和‘1’组成,当一段区间[l,r]内的‘0’和‘1’个数相等,则 ...
- redis 安装配置
reids 安装配置 1.1 下载软件包 [root@node01 ~]# mkdir -p /data/src/ [root@node01 ~]# cd /data/src/ [root@node0 ...
- AC日记——[Scoi2010]序列操作 bzoj 1858
1858 思路: 恶心: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 100005 struct Tree ...
- JavaScript备忘录-闭包(2)
闭包的定义 闭包是指函数有自由独立的变量.换句话说,定义在闭包中的函数可以“记忆”它创建时候的环境. 闭包的浅显理解 function makeFunc() { var name = "Mo ...
- UVALive - 7042 The Problem to Make You Happy 博弈
题目大意:给你一个有向图, Bob 和 Alice 在做游戏,每轮他们走一步,当Bob 和 Alice在同一个点或者 Bob无路可走,Bob输,否则Alice输. 思路:因为在Bob赢的时候存在有环的 ...