13年10个月前IP:未同步
506073
17楼
25楼
附上一段比较低效的代码
// 电梯问题.cpp : 定义控制台应用程序的入口点。
//
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
int main()
{
    vector<int> vec(32);
    for(int i=2;i<=33;i++)
    {
        int cache=0;
        int upcache=0;
        int downcache=0;
        for(int a=1;a<=33-i;a++)
        {
            upcache+=3*a;
        }
        for(int a=0;a<=i-2;a++)
        {
            downcache+=a;
        }
        cache=upcache+downcache;
        vec[i-2]=cache;
    }
          for(int i=0;i<33;i++)
          {
            cout<<i+1<<"    "<<vec[i]<<endl;
            }

}
评论
文号 / 506073

浪迹天涯
名片发私信
学术分 0
总主题 5 帖总回复 14 楼拥有证书:进士 笔友
注册于 2009/10/23 21:43:58最后登录 2016/12/29 09:23:05
主体类型:个人
所属领域:无
认证方式:邮箱
IP归属地:0

个人简介

暂未填写
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的