OJ-上海交大-1021. 从前有座山
进程间通信的方式
*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
/* BLOCKS
=============================================================================*/
p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}
/* HEADERS
=============================================================================*/
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}
h1 {
font-size: 28px;
color: #000;
}
h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777;
font-size: 14px;
}
body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
margin-top: 0;
padding-top: 0;
}
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}
/* LINKS
=============================================================================*/
a {
color: #4183C4;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* LISTS
=============================================================================*/
ul, ol {
padding-left: 30px;
}
ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt>:first-child {
margin-top: 0px;
}
dl dt>:last-child {
margin-bottom: 0px;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd>:first-child {
margin-top: 0px;
}
dl dd>:last-child {
margin-bottom: 0px;
}
/* CODE
=============================================================================*/
pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}
pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}
pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}
pre code, pre tt {
background-color: transparent;
border: none;
}
kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}
/* QUOTES
=============================================================================*/
blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
blockquote>:first-child {
margin-top: 0px;
}
blockquote>:last-child {
margin-bottom: 0px;
}
/* HORIZONTAL RULES
=============================================================================*/
hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}
/* TABLES
=============================================================================*/
table th {
font-weight: bold;
}
table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}
table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}
table tr:nth-child(2n) {
background-color: #f8f8f8;
}
/* IMAGES
=============================================================================*/
img {
max-width: 100%
}
-->
题目链接:
https://acm.sjtu.edu.cn/OnlineJudge/problem/1021
编程语言:python
import sys
num = int(sys.stdin.readline());
lines = [];
for i in range(num):
lines.append(range(num));
i = 0;
j = 0;
count = 1;
cishu = 0;
while count <= num*num:
j = cishu;
i = cishu;
while j < num - cishu:
lines[i][j] = count;
count = count + 1;
j = j +1;
j -= 1;
i += 1;
while i < num - cishu:
lines[i][j] = count;
count += 1;
i+=1;
i -= 1;
j -= 1;
while j >= 0 + cishu:
lines[i][j] = count;
count+= 1;
j -= 1;
j+=1;
i -= 1;
while i > cishu:
lines[i][j] = count;
count +=1;
i -= 1;
i += 1;
j += 1;
cishu += 1;
for i in range(num):
for j in range(num):
sys.stdout.write(str(lines[i][j]));
sys.stdout.write(" ");
sys.stdout.write("\n");
转载请注明原文地址,谢谢。
OJ-上海交大-1021. 从前有座山的更多相关文章
- 九度oj 题目1021:统计字符
题目描述: 统计一个给定字符串中指定的字符出现的次数. 输入: 测试输入包含若干测试用例,每个测试用例包含2行,第1行为一个长度不超过5的字符串,第2行为一个长度不超过80的字符串.注 ...
- 九度OJ 1021:统计字符 (基础题)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5418 解决:3146 题目描述: 统计一个给定字符串中指定的字符出现的次数. 输入: 测试输入包含若干测试用例,每个测试用 ...
- Light OJ 1021 - Painful Bases(状态压缩DP)
题目大意: 给你一个base 进制的数字,把这个数字的每一位进行全排列,问有多少个数字是可以整除k的. 题目解析: #include<cstdio> #include<cstring ...
- Light oj 1021 - Painful Bases
题意: 给一个B进制的数,一个10进制的数K,B进制数有x位, 对着x位进行全排列的话,有x!种可能, 问这x!的可能中,有多少种可以整除K,各个位置上的数字都不同. 思路:状态压缩,数位DP #i ...
- 程序猿常识--OJ系统和ACM测试考试大全
OJ它是Online Judge缩写系统,来在线检測程序源码的正确性. 著名的OJ有RQNOJ.URAL等. 国内著名的题库有北京大学题库.浙江大学题库等. 国外的题库包含乌拉尔大学.瓦拉杜利德大学题 ...
- 2016级算法第四次上机-D.AlvinZH的1021实验plus
978 AlvinZH的1021实验plus 思路 贪心,中等题. 使用miss变量表示未覆盖的最小数字,初始值为1. 初始覆盖区间为[1,miss),目标是覆盖[1,m],即miss需要大于m. 需 ...
- OJ大集合、
转载自:传送门 什么是OJ Online Judge系统(简称OJ)是一个在线的判题系统.用户可以在线提交程序源代码,系统对源代码进行编译和执行,并通过预先设计的测试数据来检验程序源代码的正确性. 一 ...
- Online Judge(OJ)搭建(第一版)
搭建 OJ 需要的知识(重要性排序): Java SE(Basic Knowledge, String, FileWriter, JavaCompiler, URLClassLoader, Secur ...
- [C#] 逆袭——自制日刷千题的AC自动机攻克HDU OJ
前言 做过杭电.浙大或是北大等ACM题库的人一定对“刷题”不陌生,以杭电OJ为例:首先打开首页(http://acm.hdu.edu.cn/),然后登陆,接着找到“Online Exercise”下的 ...
随机推荐
- cmd.ExecuteReader(CommandBehavior.CloseConnection)
有些开发人员坚持认为,如果您设置 CommandBehavior.CloseConnection 选项,则 DataReader 及其相关联的连接会在 DataReader 完成数据读取时自动关闭.这 ...
- phpexcel相关函数
1.header [php] header("Content-Type:application/vnd.ms-excel"); header("Content-Dispo ...
- R语言--数据预处理
一.日期时间.字符串的处理 日期 Date: 日期类,年与日 POSIXct: 日期时间类,精确到秒,用数字表示 POSIXlt: 日期时间类,精确到秒,用列表表示 Sys.date(), date( ...
- win7下安装mysql
(1)官网下载mysql: http://dev.mysql.com/downloads/mysql/ (2)解压后,进入到该目录下,将my-default.ini文件复制一份改名为my.ini 打开 ...
- OA项目之分页
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Digit ...
- mybatis generate 自动生成 entity dao 和 xml 文件
其中的一种方式 ,使用maven 插件 <build> <plugins> <plugin> <groupId>org.mybatis.generato ...
- linux 常用目录
/bin 执行文件 ls, mv, rm, mkdir, rmdir, gzip, tar, telnet /boot linux核心文件内核 vmlinuz-xxx(Linux 的 Kernel ...
- servers中添加server时,看不到运行环境的选择。
servers中添加server时,看不到运行环境的选择. 主要原因是tomcat目录中的配置文件格式不对.
- MySQL MHA配置
MySQL环境: master:192.168.202.129:3306 slave:192.168.202.129:3307,192.168.202.129:3307,192.168.202.130 ...
- ArcGIS移动开发策略的选择[转]
智能设备变得越来越普及,从三岁大的小孩到祖父祖母辈都能顺利使用,信息从没像如此这般的容易传递到每个人的手中,开发者们普遍觉得应该慎重考虑下移动开发策略,是web的.混合的.还是native的更好. 这 ...