题解 | #奇偶统计#
奇偶统计
https://www.nowcoder.com/practice/04de8eb0ecab426fa6be3ae99af17210
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
sc.close();
if(N % 2 == 0){
System.out.printf("%d %d", N/2, N/2);
}else{
System.out.printf("%d %d", N/2+1, N/2);
}
}
}
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
sc.close();
if(N % 2 == 0){
System.out.printf("%d %d", N/2, N/2);
}else{
System.out.printf("%d %d", N/2+1, N/2);
}
}
}
查看12道真题和解析