⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2014.txt

📁 北大ACM题目例程 详细的解答过程 程序实现 算法分析
💻 TXT
字号:


#include<stdio.h>
#include<string.h>
#define debug 0


#define NMAX 1026
int a[NMAX][NMAX];
int main()
{

#if debug 	
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
  	int x,y;
  	int maxx;
  	int maxy;
  	int wide;
  	int a,b;
  	scanf("%d",&wide);
  	while(wide)
  	{
  		a=0;b=0;
  		maxy=0;
  		maxx=0;
  		scanf("%d%d",&x,&y);
  		while(x!=-1)
  		{
  			if(a+x<=wide)
  			{
  				a+=x;
  				if(a>maxx)
  					maxx=a;
  				if(b+y>maxy)
  					maxy=b+y;
  			}
  			else
  			{
  				a=0;
  				b=maxy;
  				continue;
  			}
	  		scanf("%d%d",&x,&y);
  		}
  		printf("%d x %d\n",maxx,maxy);
  		
  		scanf("%d",&wide);
  	}
  		  	
  	
#if debug
	fclose(stdin);
	fclose(stdout);
#endif
	return 1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -