- import java.util.*;
- class Main
- {
- public static void main(String args[])
- {
- //Fill your code here
- Scanner sc=new Scanner(System.in);
- int n=sc.nextInt();
- int r=sc.nextInt();
- int c=sc.nextInt();
- int grid[][]=new int[n+1][n+1];
- int v=1;
- for(int i=1;i<=n;i++)
- {
- if(i%2==1)
- {
- for(int j=1;j<=n;j++)
- {
- grid[i][j]=v;
- v++;
- }
- //System.out.println();
- }
- else
- {
- for(int j=n;j>=1;j--)
- {
- grid[i][j]=v;
- v++;
- // System.out.print(grid[i][j]+" ");
- }
- //System.out.println();
- }
- }
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- {
- System.out.print(grid[i][j]+" ");
- }
- System.out.println();
- }
- System.out.println(grid[r][c]);
- }
- }
[text] 7777777777
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: