View Code of Problem 87

#include<stdio.h>
int main(){
	int a;
	scanf("%d",&a);
	//至少
	int x=a/4;
	while((a-4*x)%2!=0&&x>=0) x--;
	if(x<0){
		printf("0 ");
	}
	else
		printf("%d ",x+(a-4*x)%2);
	//至多 
		x=a/2;
	while((a-2*x)%4!=0&&x>=0) x--;
	if(x<0){
		printf("0\n");
	}
	else
		printf("%d\n",x+(a-2*x)%4);
	
	
}

Double click to view unformatted code.


Back to problem 87