社区讨论

我写过的无敌代码(违反紫衫)

B3626跳跃机器人参与者 12已保存回复 13

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
13 条
当前快照
1 份
快照标识符
@mhji46d9
此快照首次捕获于
2025/11/04 02:56
4 个月前
此快照最后确认于
2025/11/04 06:24
4 个月前
查看原帖
本题:
CPP
#include<bits/////////stdc++.h>
using namespace std;
struct _ 
{
    int _________, __________;;
};;
int ___;;
bool _____[1000005];;
void ____() {
    queue <_> ________;;
    ________.push({1,0});;
    while(!________.empty()) 
    {
        _ __ = ________.front();;
        ________.pop();;
        int ______ = __._________, _______ = __.__________;
        if(______<1||______>___)
            continue;;          
        if(_____[______]) 
            continue;; 
        _____[______] = 1;;
        if(______ == ___) 
        {
            cout << _______ << endl;;
            return;
        }
        ________.push({______-1,_______+1});;
        ________.push({______+1,_______+1});
        ________.push({______*2,_______+1});
    }
}
int main() {
    cin >> ___;
    ____();
    return 0;
}
还是本题
CPP
#include <bits/stdc++.h>
using namespace std;
int n,m,qnm;
char a[105][105];
bool vis[105][105];
struct c
{
    int x, y;
};
void wc() {
    queue<c> q;
    c tmd;
    tmd.x = 1, tmd.y = 1;
    q.push(tmd);
    while(!q.empty()) 
    {
        c cnm = q.front();
        q.pop(); 
        int x = cnm.x;
        int y = cnm.y;
        if(x < 1 || x > n)
        {
            continue;
        }
        if(y<1||y>m)
        {
            continue;
        }
        if(a[x][y] == '#') 
        {
            continue; 
        }
        if(vis[x][y])
        {
            continue;
        }
        vis[x][y] = 1;
        if(x == n && y == m)
        {
            qnm= 1;
            return;
        }

        c sb;
        sb.x = x - 1, sb.y = y; 
        q.push(sb);

        sb.x = x+1,sb.y = y; 
        q.push(sb);
        sb.x = x,sb.y = y-1; 
        q.push(sb);

        sb.x = x,sb.y = y+1; 
        q.push(sb);
    }
}

int main() {
    cin >> n >> m; 
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            cin >> a[i][j];
        }
    }
    wc();
    if(qnm)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}
学而思的题
CPP
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
typedef int _________;
_________ _;
_________ __[10005];
_________ ___;
stack<_________>_____;
bool ____()
{
    _________ ______ = 0;
    for(_________ _______ = 1;_______<=___;++_______)
    {
        while(______<=__[_______])
        {
            _____.push(______);
            ______++;
        }
        if(_____.top()==__[_______])
        {
            _____.pop();
        }
        else
        {
            return 0;
        }
    }
    return 1;
}
int main(){
	cin>>_;
	while(_--)
	{
	   cin>>___;
	   for(_________ ________ = 1;________<=___;++________)
	   {
	       cin>>__[________];
	   }
	   if(____())
	   {
	       cout<<"Yes"<<endl;
	   }
	   else
	   {
	       cout<<"No"<<endl;
	   }
	}
	return 0;
}
学而思:
CPP
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ________;
typedef int _________;
int main() {
	_________ _,__;
	________ ____[200005],___;
	map<________,________>______,_______;
	cin>>_>>__;
	for(_________ _____ = 1;_____<=_;++_____)
	{
	    cin>>____[_____];
	    _______[____[_____]]++;
	}
	for(_________ _____ = 1;_____<=_;++_____)
	{
	    _______[____[_____]]--;
	    if(____[_____]%__==0)
	    {
	        ___ += ______[____[_____]/__]*_______[____[_____]*__];
	    }
	    ______[____[_____]]++;
	}
	cout<<___;
    return 0;
}

回复

13 条回复,欢迎继续交流。

正在加载回复...