训练集--群赛17

T1

A sequence a0, a1, …, at - 1 is called increasing if ai - 1 < ai for each i: 0 < i < t.

You are given a sequence b0, b1, …, bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence increasing?
暴力贪心,将每一个比前面小(或等于)的加到比前一个大即可。

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,i,b[2010];
    long long int ans=0;
    scanf("%d%d",&n,&d);
    for(i=0;i<=n-1;i++)
     scanf("%d",&b[i]);
    for(i=1;i<=n-1;i++)
     {if(b[i]<=b[i-1])
      {if(b[i]==b[i-1])
        {ans++;b[i]+=d;
        }
       else
        {ans+=((b[i-1]-b[i])/d+1);
         b[i]+=((b[i-1]-b[i])/d+1)*d;
        }   
      }
     } 
  cout<<ans;     
}

T2

Jack is working on his jumping skills recently. Currently he’s located at point zero of the number line. He would like to get to the point x. In order to train, he has decided that he’ll first jump by only one unit, and each subsequent jump will be exactly one longer than the previous one. He can go either left or right with each jump. He wonders how many jumps he needs to reach x.
现将输入取绝对值,之后其实只要一直加到值为所求或大于并且为双数即可输出(往后跳可以调一切双数。)

#include<bits/stdc++.h>
using namespace std;
int main() {
    int x,a=0,c=0;
    scanf("%d",&x);
    if(x<0)x=-x;
    for(int i=1; i<=100000&&!(a>x&&!((a-x)&1))&&a!=x; i++) {
        a+=i;
        c++;
    }
    !x?cout<<0:cout<<c;
}

T4

Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges.
状态压缩dp。第一维压路径,第二维表示路径终点,枚举所有路径与其他路径产生环的个数,最后除以2输出。

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[1<<19][19];int x,y,n,m;bool flag,mp[19][19];
inline ll solve()
{ll ans=0;int i,j,k;
  for(i=0;i<(1<<n);i++) 
    {flag=1;
     for(j=0;j<n;j++) 
     if(((i&(1<<j)))&&(!dp[i][j])) 
       if(flag)flag=0,k=j;
       else 
        {for(y=k+1;y<n;y++)
          if(((i&(1<<y)))&&(mp[y][j]))
           dp[i][j]+=dp[i-(1<<j)][y];
           if(mp[k][j])
           ans+=dp[i][j];}
        }
  return ans>>=1;   
}
int main() 
{   scanf("%d%d",&n,&m);
    while(m--) 
    {   scanf("%d%d",&x,&y);
        x--,y--;
        mp[x][y]=mp[y][x]=1;
        if(x>y)swap(x,y);
        dp[(1<<x)+(1<<y)][y]++;}    
    printf("%lld",solve());}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于使用COCO数据集训练ST-GCN(Spatio-Temporal Graph Convolutional Networks)模型,你需要完成以下步骤: 1. 数据准备:从COCO数据集中提取出包含人体姿势信息的图像。COCO数据集提供了标注了人体关键点的图像,你可以使用这些关键点来表示人体姿势。 2. 数据预处理:对于每个图像,你需要将关键点坐标转换为关节点的三维坐标表示。这可以通过将每个关节点的二维坐标映射到图像平面上来实现。 3. 构建图形:使用关节点的三维坐标来构建图形结构。ST-GCN使用图形结构来建模人体姿势的时空关系。你可以根据关节点之间的距离或连接关系来构建图形。 4. 特征提取:基于构建的图形结构,你可以使用ST-GCN模型提取人体姿势的时空特征。ST-GCN模型采用了时空图卷积操作,可以有效地捕捉动作序列中的时空信息。 5. 训练模型:使用预处理的数据和特征提取的结果,你可以将ST-GCN模型进行训练。训练过程中,你可以使用COCO数据集中提供的标注信息来监督模型的学习。 6. 模型评估:训练完成后,你可以使用测试集数据对训练好的ST-GCN模型进行评估。评估指标可以包括准确率、召回率等。 请注意,以上步骤仅为一般步骤,具体实现可能因应用场景和需求而有所不同。此外,ST-GCN模型的训练可能需要较大的计算资源和时间,因此你可能需要考虑使用GPU加速和分布式训练等技术来加快训练过程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值