|
|
back to boardNo subject Posted by Bart11 22 Apr 2018 18:51 import java.util.Scanner; public class task9 {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); int cl = 0; int stroka =1; int[][] mas = new int[n][m]; for(int i=0;i<n;i++){ if(stroka%2==1){ for(int j=0;j<m;j++){ mas[i][j]=cl; cl++;
} stroka++; } else{ for(int j=m-1;j>=0;j--){ mas[i][j]=cl; cl++; } stroka++; } } System.out.println(mas[x-1][y-1]);
}
} Re: No subject Posted by Jetlog 7 May 2019 14:29 ¼script¾alert(¢1¢)¼/script¾ Edited by author 07.05.2019 14:29 Edited by author 07.05.2019 14:36 |
|
|