当前位置: 首页 > news >正文

上海新闻官网seo优化方案

上海新闻官网,seo优化方案,手机开发安卓app,教育机构报名螺旋类 package entity; /*** 打印数组螺旋值类*/ public class Spiral { // 数组行private int row; // 数组列private int col; // 行列数private int size; // 当前行索引private int rowIndex; // 当前列索引private int colIndex; // 行开始索引private int rowStart; //…

螺旋类

package entity;
/*** 打印数组螺旋值类*/
public class Spiral {
//	数组行private int row;
//	数组列private int col;
//	行列数private int size;
//	当前行索引private int rowIndex;
//	当前列索引private int colIndex;
//	行开始索引private int rowStart;
//	行结束索引private int rowEnd;
//	列开始索引private int colStart;
//	列结束索引private int colEnd;
//	数组private int[][] spiralArray;
//	保存数组private int[][] saveArray;
//	构造方法public Spiral(int row,int col,int[][] spiralArray) {this.row = row;this.col = col;this.rowStart = 0;this.rowEnd = row - 1;this.colStart = 0;this.colEnd = col - 1;this.size = row*col;this.spiralArray = spiralArray;this.saveArray = new int[row][col];for(int[] r : this.saveArray) {for(int i=0;i<r.length;i++) {r[i] = Integer.MIN_VALUE;}}}
//	打印螺旋值public void printSpiral() {
//		行列1时打印螺旋值if(this.row==1||this.col==1) {printArray();return;}while(size-->0) {printData();saveData();setRange();if(this.rowIndex==this.rowStart&&this.colIndex<this.colEnd) {toRight();}else if(this.rowIndex<this.rowEnd&&this.colIndex==this.colEnd) {toDown();}else if(this.rowIndex==this.rowEnd&&this.colIndex>this.colStart) {toLeft();}else if(this.rowIndex>this.rowStart&&this.colIndex==this.colStart) {toUp();}}}
//	设置行列开始结束值private void setRange() {
//		开始结束值的界分int rowDivide = this.row/2;int colDivide = this.col/2;
//		判断一行每个元素是否都走完for(int i=0;i<this.row;i++) {int colCount = 0;int[] r = this.saveArray[i];for(int j=0;j<this.col;j++) {int c = r[j];if(c!=Integer.MIN_VALUE) {++colCount;}}if(colCount==this.col) {if(i+1<rowDivide) this.rowStart = i + 1;if(i-1>=rowDivide) this.rowEnd = i - 1;}}
//		判断列元素是否走完for(int i=0;i<this.col;i++) {int rowCount = 0;for(int j=0;j<this.row;j++) {int data = this.saveArray[j][i];if(data!=Integer.MIN_VALUE) {++rowCount;}}if(rowCount==this.row) {if(i+1<colDivide) this.colStart = i + 1;if(i-1>=colDivide) this.colEnd = i - 1;}}}//	打印数组private void printArray() {for(int[] arr : this.spiralArray) {for(int data : arr) {System.out.print(data);}}}
//	打印元素private void printData() {System.out.print(this.spiralArray[this.rowIndex][this.colIndex]);}
//	向上移动private void toUp() {this.rowIndex = (this.rowIndex-1)>=0?--this.rowIndex:0;}
//	向下移动private void toDown() {this.rowIndex = (this.rowIndex+1)<this.row?++this.rowIndex:this.row-1;}
//	向左移动private void toLeft() {this.colIndex = (this.colIndex-1)>=0?--this.colIndex:0;}
//	向右移动private void toRight() {this.colIndex = (this.colIndex+1)<this.col?++this.colIndex:this.col-1;}
//	保存已经过数据private void saveData() {this.saveArray[this.rowIndex][this.colIndex] = this.spiralArray[this.rowIndex][this.colIndex];}
}

测试类

package test;import java.util.Arrays;import entity.Spiral;public class SpiralTest {public static void main(String[] args) {
//		int row = 1;
//		int col = 1;
//		int[][] array = {{1}};
//		int row = 1;
//		int col = 2;
//		int[][] array = {{1,2}};
//		int row = 2;
//		int col = 1;
//		int[][] array = {{1},{2}};int row = 4;int col = 5;int[][] array = new int[row][col];for(int[] r : array) {for(int i=0;i<r.length;i++) {r[i] = (int)(Math.random()*100);}}System.out.println(Arrays.deepToString(array));Spiral sp = new Spiral(row,col,array);sp.printSpiral();}}

http://www.15wanjia.com/news/49497.html

相关文章:

  • 山东省水利建设市场信用信息平台网站网站建设方案外包
  • 基金网站开发seo自动推广软件
  • 招聘网站如何做SEO国际新闻最新消息2022
  • 做网站 数据库14个seo小技巧
  • 大型网站服务器价格市场调研表模板
  • 旅游网站模板psd关键词搜索网站
  • 阿里做外贸的网站百度关键词排名联系方式
  • 开发流程和步骤北京seo营销公司
  • 涿州网站制作网络推广和网站推广
  • 农业畜牧网站开发seo网站优化方案书
  • 网站排名查询工具有哪些推广普通话心得体会
  • 网站欣赏与创建网页广告宣传费用一般多少
  • 关于做面包的网站游戏推广员怎么做
  • 网站建设技术服务清单销售管理系统
  • 龙岩资讯seo专业课程
  • 做360手机网站快速排名软件阿里指数查询官网入口
  • 建立微信商城网站培训班报名
  • 抖音网站开发网络营销推广合作
  • 阿里云服务器做电影网站吗西安网站搭建公司
  • wordpress安卓源码分析只要做好关键词优化
  • wordpress修改文章浏览次数网站seo诊断工具
  • 网站怎么做任务赚钱如何添加百度指数
  • 北京网站设计公司sx成都柚米科技15网络推广策划
  • b2c中日外贸有哪些网站做的好上海关键词优化方法
  • 延庆区住房城乡建设委官方网站网站seo诊断优化方案
  • 佛山企业门户网站建设百度主页网址
  • 社交网站开发流程什么是网络营销的核心
  • 门头沟石家庄网站建设营销网站建设规划
  • wordpress 西部数码seo在线推广
  • 24小时自助下单平台网站便宜seo推广公司教程