题解 | #鸡兔同笼#
鸡兔同笼
https://www.nowcoder.com/practice/fda725b4d9a14010bb145272cababef1
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ int n=sc.nextInt(); if(n%2!=0){ System.out.println("0 0"); }else{ int min,max; if(n%4==0){ min=n/4; max=n/2; }else{ min=n/4; min+=(n%4)/2; max=n/2; } System.out.println(min+" "+max); } } } }