解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class T1538 { public static void main(String[] args) { Scanner in = new Scanner(System.in); while(in.hasNext()){ int n = in.nextInt(),i = in.nextInt(),j = in.nextInt(); String s[] = {"","","",""}; for(int j_ = 1;j_<=n;j_++){ for(int i_ = 1;i_<=n;i_++){ if(i_ == i) s[0] +="(" + i_ + "," + j_ + ")"; if(j_ == j) s[1] += "(" + i_ + "," + j_ + ")"; if(j_ - i_ == j - i) s[2] += "(" + i_ + "," + j_ +")"; } for(int i_ = 1;i_<=n;i_++) if(j_ + i_ == j + i) s[3] += "(" + i_ + "," + j_ + ")"; } for(int k = 0;k<4;k++) System.out.println(s[k]); } in.close(); } }
0.0分
0 人评分