Paths on a Grid(规律)

Paths on a Grid
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 23270 Accepted: 5735

Description

Imagine you are attending your math lesson at school. Once again, you are bored because your teacher tells things that you already mastered years ago (this time he's explaining that (a+b) 2=a 2+2ab+b 2). So you decide to waste your time with drawing modern art instead. 

Fortunately you have a piece of squared paper and you choose a rectangle of size n*m on the paper. Let's call this rectangle together with the lines it contains a grid. Starting at the lower left corner of the grid, you move your pencil to the upper right corner, taking care that it stays on the lines and moves only to the right or up. The result is shown on the left: 

Really a masterpiece, isn't it? Repeating the procedure one more time, you arrive with the picture shown on the right. Now you wonder: how many different works of art can you produce?

Input

The input contains several testcases. Each is specified by two unsigned 32-bit integers n and m, denoting the size of the rectangle. As you can observe, the number of lines of the corresponding grid is one more in each dimension. Input is terminated by n=m=0.

Output

For each test case output on a line the number of different art works that can be generated using the procedure described above. That is, how many paths are there on a grid where each step of the path consists of moving one unit to the right or one unit up? You may safely assume that this number fits into a 32-bit unsigned integer.

Sample Input

5 4
1 1
0 0

Sample Output

126
2
题解:找规律,总共走了m+n步,从这m+n步中选m步向右,规律很容易找出来,但是却是无符号的32位;
代码:
 1 #include<stdio.h>
 2 #include<math.h>
 3 const int MAXN=100010;
 4 int main(){
 5     __int64 N,ans;
 6     int T;
 7     scanf("%d",&T);
 8     while(T--){
 9         ans=0;
10         scanf("%I64d",&N);
11         N++;
12         int flot=0;
13         for(int i=2;i<=sqrt(N);i++)if(N%i==0)ans++;
14         printf("%I64d\n",ans);
15     }
16     return 0;
17 }

 

graph TD A[薄层沥青罩面层间增韧关键技术研究] --> B(研究内容) B --> B1["(1)原有路面快速升温方法研究"] B --> B2["(2)旧路面热学响应研究"] B --> B3["(3)热拼接层间粘结效果评价"] B --> B4["(4)关键施工工艺优化"] %% 第一阶段:快速升温技术研发 %% B1 --> C1["文献调研与技术筛选"] C1 --> C2["实验室小试平台搭建"] C2 --> C3["升温参数优化实验:<br>• 功率/距离/时间<br>• 温度场监测(热电偶+红外)<br>• 能耗与热损伤评估"] C3 --> C4["技术对比:红外/微波/热风/复合"] C4 --> C5["输出:优选升温方案与参数"] %% 第二阶段:热学响应机理 %% B2 --> D1["多因素试验设计:<br>• 材料组成/温度/含水率/环境"] D1 --> D2["精细化测温:<br>• 埋入式传感器阵列<br>• 红外热像仪动态监测"] D2 --> D3["热学响应规律分析:<br>• 温度梯度/均匀性/衰减速率"] D3 --> D4["数值模型构建与验证:<br>• COMSOL热传导模拟"] D4 --> D5["输出:热响应图谱+安全阈值"] %% 第三阶段:粘结性能科学评价 %% B3 --> E1["热拼接参数化试验:<br>• 界面温度/接触时间/压力"] E1 --> E2["多尺度性能测试:"] E2 --> E2a["• 力学性能:直剪/拉拔/斜剪(强度+韧性)"] E2 --> E2b["• 耐久性:水损害/冻融/疲劳试验"] E2 --> E2c["• 微观分析:SEM界面观测"] E2a & E2b & E2c --> E3["数据建模:工艺参数-性能关系"] E3 --> E4["输出:粘结效果评价方法体系"] %% 第四阶段:施工工艺集成 %% B4 --> F1["工艺链优化实验:"] F1 --> F1a["• 界面处理:清理+粘层油优化"] F1 --> F1b["• 混合料设计:高温稳定性保障"] F1 --> F1c["• 摊铺压实:参数正交试验"] F1a & F1b & F1c --> F2["试验路验证:<br>• 压实度+粘结强度+平整度检测"] F2 --> F3["质量控制标准:<br>• 关键指标阈值+无损检测技术"] F3 --> F4["输出:《层间增韧施工工艺规程》"] %% 逻辑闭环与成果转化 %% C5 --> D1 & E1 & F1 %% 升温方案指导热响应/粘结/工艺研究 D5 --> E1 & F1 %% 热响应规律指导粘结与工艺 E4 --> F1 %% 粘结评价结果反馈工艺优化 F4 --> G["工程应用验证"] G --> H["技术推广与标准编制"] style A fill:#2c3e50,stroke:#34495e,color:white,fontsize:15px style B fill:#3498db,stroke:#2980b9 style B1 fill:#16a085,stroke:#1abc9c style B2 fill:#27ae60,stroke:#2ecc71 style B3 fill:#f39c12,stroke:#f1c40f style B4 fill:#d35400,stroke:#e67e22我想用MATLAB把这个技术路线图画出来,帮我修改代码,使得其能够在MATLAB中运行
最新发布
07-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值