Problem F Mountain Scenes

本文探讨了一位艺术家使用不同长度的丝带片段创建山景的可能性。通过数学和编程手段,解决了如何计算在给定丝带长度和画框尺寸的情况下,能够创造出多少种不同的山景图案的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这是一道naipc里的题,题目链接:https://vjudge.net/contest/313660#problem/F

An artist begins with a roll of ribbon, one inch wide. She clips it into pieces of various integral lengths, then aligns them with the bottom of a frame, rising vertically in columns, to form a mountain scene. A mountain scene must be uneven; if all columns are the same height, it’s a plain scene, not a mountain scene! It is possible that she may not use all of the ribbon. If our artist has 4 inches of ribbon and a 2 × 2 inch frame, she could form these scenes: She would not form these scenes, because they’re plains, not mountains! Given the length of the ribbon and the width and height of the frame, all in inches, how many different mountain scenes can she create? Two scenes are different if the regions covered by ribbon are different. There’s no point in putting more than one piece of ribbon in any column.

Input

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs.

The input will consist of a single line with three space-separated integers n, w and h, where n (0 ≤ n ≤ 10,000) is the length of the ribbon in inches, w (1 ≤ w ≤ 100) is the width and h (1 ≤ h ≤ 100) is the height of the frame, both in inches. North American Invitational Programming Contest 2016

Output

Output a single integer, indicating the total number of mountain scenes our artist could possibly make, modulo 109 + 7.

Sample

Input

1

Sample

Output

1 25 5 5 7770

Sample

Input

2

Sample

Output

2 15 5 5 6050

Sample

Input

3

Sample

Output

3 10 10 1 1022

Sample

Input

4

Sample

Output

4 4 2 2 6 

题解:

前半段总结了一下规律,但能力有限没有总结出一个简洁的规律可以概括所有情况,只能概括n>=w*h的情况,以后能力强了应该会回过头来看看

#include<stdio.h>
#include<math.h>
typedef long long ll;
const ll mo=1e9+7;
ll quick(ll a,ll n,ll m)
{
    ll ans=1;
    while(n)
	{
        if(n&1)
		{
            ans=(ans*a)%m;
        }
        a=(a*a)%m;
        n>>=1;
    }
    return ans;
}
int min(int a,int b){return a<b?a:b;}
ll dp[10010];
int main()
{
	int n,w,h,i,j,k;
	ll ans;
	scanf("%d%d%d",&n,&w,&h);
	if(n>=h*w)ans=(quick(h+1,w,mo)-h-1+mo)%mo;
	else 
	{
		dp[0]=1;
		for(i=1;i<=w;i++)
			for(j=n;j>=0;j--)
				for(k=1;k<=h&&j-k>=0;k++)
					dp[j]=(dp[j]+dp[j-k])%mo;
		ans=mo-min(h+1,n/w+1);
		for(i=0;i<=n;i++)ans=(ans+dp[i])%mo; 
	}
	printf("%lld",ans); 
	return 0;
}

 

### 关于7Scenes数据集 7Scenes 是一种广泛应用于计算机视觉领域的数据集,主要用于研究基于单目相机的结构化环境中的位姿估计和三维重建问题。该数据集由微软剑桥研究院发布,包含了七个不同的室内场景(例如办公室、会议室等),并提供了丰富的图像序列以及对应的精确六自由度 (6DoF) 相机姿态标注[^1]。 #### 数据集特点 - **场景多样性**:涵盖了多种典型的室内办公环境。 - **多视角采集**:通过八台摄像机同步录制视频片段,从而提供不同角度下的视图信息[^3]。 - **高精度标签**:每张图片都附带了经过校准后的绝对位置与方向参数作为真值用于验证模型性能。 #### 获取方式 虽然官方并未直接开放统一入口供公众访问全部资源文件,但可以通过以下途径找到相关内容: 1. 前往原始论文作者所在机构网站查询是否有更新版本或者补充材料; 2. 利用第三方托管平台如GitHub搜索相关项目仓库可能包含整理好的镜像链接地址;比如可以尝试浏览类似的综合性CV数据库列表页面获取线索。 对于具体操作指南而言,则需注意以下几点事项: #### 安装依赖项 确保安装必要的库来处理这些大型二进制格式的数据包。Python环境下推荐使用`numpy`, `opencv-python`等工具辅助解析图像帧及其元数据字段。 ```python pip install numpy opencv-python ``` #### 解压与预览样本 下载完成后通常会得到压缩形式存档(.zip/.tar.gz),解压后按照目录结构调整好路径以便后续加载脚本调用方便。下面给出一段简单的代码示例展示如何读取其中一张RGB照片连同其关联的姿态向量一起显示出来。 ```python import cv2 import numpy as np def load_image_and_pose(image_path, pose_path): img = cv2.imread(image_path) with open(pose_path,'r') as f: lines=f.readlines() poses=np.array([float(x.strip())for line in lines[:4]for x in line.split(' ')]) rotation_matrix=poses.reshape((3,4))[:,:3] translation_vector=poses.reshape((3,4))[:,3] return img ,rotation_matrix,translation_vector if __name__ == "__main__": image_file="path_to_your_unzipped_folder/scene_0/frame_xxx.color.png" pose_file="path_to_your_unzipped_folder/scene_0/frame_xxx.pose.txt" rgb_img,R,t=load_image_and_pose(image_file,pose_file) # Show the loaded RGB image cv2.imshow("Sample Image",rgb_img ) cv2.waitKey(0) cv2.destroyAllWindows() ``` 上述程序段落实现了基本功能——即从指定磁盘位置提取一幅彩色画面再加上对应的世界坐标系变换矩阵R和平移矢量t共同构成完整的刚体运动描述符表示当前时刻摄像头所处状态。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值