ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

寒假学习记录D16

2022-01-25 23:31:54  阅读:139  来源: 互联网

标签:D16 putchar 记录 int ll 3005 read 寒假 include


1.OpenCV

2.web前端-CSS

3.算法基础练习


(1)OpenCV

 

 


(2)web前端 

 

 

 

 

 


 (3)算法基础练习

题目描述

赛时提示:保证出发点和终点都是空地

帕秋莉掌握了一种木属性魔法

这种魔法可以生成一片森林(类似于迷阵),但一次实验时,帕秋莉不小心将自己困入了森林

帕秋莉处于地图的左下角,出口在地图右上角,她只能够向上或者向右行走

现在给你森林的地图,保证可以到达出口,请问有多少种不同的方案

答案对2333取模

输入描述:

第一行两个整数m , n表示森林是m行n列
接下来m行,每行n个数,描述了地图
0  -  空地
1  -  树(无法通过)

输出描述:

一个整数表示答案

示例1

输入

3 3
0 1 0
0 0 0
0 0 0

输出

3

备注:

对于30%的数据,n,m≤100
对于100%的数据,n,m≤3,000
数据规模较大,请使用较快的输入方式,以下为快速读入模板

template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}

scanf("%d",&x)  ->  read(x)
cin>>x -> read(x)

(调用方式:read(要读入的数))

 

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include<iostream>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define space putchar(' ')
#define enter putchar('\n')
typedef pair<int,int> PII;
const int mod=1e4+7;
const int N=2e6+10;
const int inf=0x7f7f7f7f;


ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}

ll lcm(ll a,ll b)
{
    return a*(b/gcd(a,b));
}

template <class T>
void read(T &x)
{
    char c;
    bool op = 0;
    while(c = getchar(), c < '0' || c > '9')
        if(c == '-')
            op = 1;
    x = c - '0';
    while(c = getchar(), c >= '0' && c <= '9')
        x = x * 10 + c - '0';
    if(op)
        x = -x;
}
template <class T>
void write(T x)
{
    if(x < 0)
        x = -x, putchar('-');
    if(x >= 10)
        write(x / 10);
    putchar('0' + x % 10);
}

int fa[N];
int n,m;
int a[3005][3005];
int dp[3005][3005];
int vis[3005][3005];
int main()
{
    read(n),read(m);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
    {
        read(a[i][j]);
        if(a[i][j]==1)vis[i][j]=1;
    }
    vis[n][1]=1;
    dp[n][1]=1;
    for(int i=n;i>=1;i--)
        for(int j=1;j<=m;j++)
    {
        if(!vis[i][j])
        {
                dp[i][j]=(dp[i+1][j]+dp[i][j-1])%2333;
        }
    }
    write(dp[1][m]);


    return 0;
}








标签:D16,putchar,记录,int,ll,3005,read,寒假,include
来源: https://blog.csdn.net/qq_53782756/article/details/122693151

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有