📄 1685.cpp
字号:
/* This Code is Submitted by wywcgs for Problem 1685 on 2005-03-24 at 07:12:02 */
#include <stdio.h>
int main()
{
int maxWid, totalLen, totalWid, recLen, recWid;
int curLen, curWid;
while(scanf("%d", &maxWid) == 1){
if(maxWid == 0){
return 0;
}else{
totalLen = 0;
totalWid = 0;
curLen = 0;
curWid = 0;
while(scanf("%d %d", &recWid, &recLen) == 2){
if((recLen == -1) && (recWid == -1)){
if(totalWid < curWid){
totalWid = curWid;
}
totalLen += curLen;
break;
}else{
if(recWid + curWid <= maxWid){
curWid += recWid;
if(curLen < recLen){
curLen = recLen;
}
}else{
if(totalWid < curWid){
totalWid = curWid;
}
curWid = recWid;
totalLen += curLen;
curLen = recLen;
}
}
}
printf("%d x %d\n", totalWid, totalLen);
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -