import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改
public class Main {public static int is1(char ch[][],int m,int n){int ans=0;for (int i=0;i<m;i++){for (int j=0;j<n;j++){int add=1;while(j+add<n){if(ch[i][j]<ch[i][j+add]) ans++; //横add++;}add=1;while(i+add<m){if(ch[i][j]<ch[i+add][j]) ans++; //列递增add++;}add=1;while (i+add<m&&j+add<n){if (ch[i][j]<ch[i+add][j+add]) ans++; //右下add++;}add =1;while(i-add>=0&&j+add<n){if (ch[i][j]<ch[i-add][j+add]) ans++; //右上add++;}add=1;while(i+add<m&&j-add>=0){if (ch[i][j]<ch[i+add][j-add]) ans++; //左下add++;}}}return ans;}public static void main(String[] args) {/*Scanner scan = new Scanner(System.in);int m=30,n=50;char ch[][] = new char[m][n];for(int i=0;i<m;i++){char st[] = scan.nextLine().toCharArray();ch[i] = st;}System.out.println(is1(ch,m,n));//在此输入您的代码...scan.close();*/System.out.println("52800");}
}
横向:LN LN AN AN IO AO
纵向:LQ AI NO
右斜向下:NO
右斜向上: IN AN
左斜向下:AQ
左斜向上:
题中说只有13个递增序列,所以就没有左斜向上了,
....