2022年江西省大学生程序设计竞赛(热身赛) A CD

https://ac.nowcoder.com/acm/contest/43897#question

AC都没什么好讲的

A-anxin Selects Soldiers

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=200200,M=2002;
LL a[N];
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    int n;
    cin>>n;
    LL sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    sum*=2;
    cout<<sum<<endl;
    return 0;
}

C-Kong Rong Shares Pears

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=200200,M=2002;
LL a[M][M];
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>a[i][j];
        }
    }
    for(int i=1;i<=n;i++)
    {
        LL minn=a[i][1];
        for(int j=1;j<=m;j++)
        {
            minn=min(minn,a[i][j]);
        }
        cout<<minn<<endl;
    }
    return 0;
}

D-Jichang Xueshe

题目大意:

这个题目说的是一个三视图,每次选择一个点,打通它。

注意这是个三视图,所以我们必须要三面都把这个点打通。

问我们在m次操作之后,这个长度为n的正方体还剩下多少个小格子?
输入 
3 1
1 1
输出 
20
  1. 我们可以把它看成一个三维的坐标轴
    附带一张很抽象的图【没错,它没有反,它就是长这样的】
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL N=200200,M=120;
LL a[120][120][120];
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL n,m;
    cin>>n>>m;
    memset(a,1,sizeof a);
    while(m--)
    {
        LL x,y;
        cin>>x>>y;
        for(int i=1;i<=n;i++)
        {
            a[i][x][y]=0;
            a[x][i][y]=0;
            a[x][y][i]=0;
        }
    }
    LL sum=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                if(a[i][j][k]) sum++;
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}
posted @ 2022-10-24 21:46  高尔赛凡尔娟  阅读(224)  评论(1编辑  收藏  举报