|
|
вернуться в форумWA 13 Can anyone say, what is wrong in my solution? public class T1779 { public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); int n=Integer.parseInt(in.readLine()); int sum=0; for(int i=0; i<n/2; i++){ for(int j=n-i-1; j<n; j++){ if(i!=j){ out.println((i+1)+" "+(j+1)); sum++; } } } System.out.println(sum); out.close(); } } Re: WA 13 Послано Anti 28 ноя 2023 18:09 Repalce the conditions i != j with i < j because you print some edges twice. Sorry for my bad English |
|
|