- 分享日常
(自留)蓝桥杯模拟赛代码
-
Nijika_jia LV 6 MOD @ 3 个月前
1 : 23
2 : 259072
3 : 2001
4 : 93
5 : 32736
6 :
#include<bits/stdc++.h>
#define int long long
#define PII pair<int,int>
#define ULL unsigned long long
#define all(v) v.begin(), v.end()
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int N = 1 * 1e6 + 10,M = 5 * 1e3 + 10,inf = 0x3f3f3f3f;
void solve()
{
int n;
cin >> n;
cout << ceil(2024.0 / n) << '\n';
}
signed main()
{
ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
int _=1;
// cin>>_;
while(_--)
{
solve();
}
return 0;
}
/**
* author: Nijika_jia
* created: 2024.12.07 15:05:04
*/
7 :
#include<bits/stdc++.h>
#define int long long
#define PII pair<int,int>
#define ULL unsigned long long
#define all(v) v.begin(), v.end()
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int N = 1 * 1e6 + 10,M = 5 * 1e3 + 10,inf = 0x3f3f3f3f;
void solve()
{
int n;
cin >> n;
int ans = inf;
for(int i=0;i<n;i++)
{
int x;
cin >> x;
if(x % 2 == 0) ans = min(ans,x);
}
cout << ans << '\n';
}
signed main()
{
ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
int _=1;
// cin>>_;
while(_--)
{
solve();
}
return 0;
}
/**
* author: Nijika_jia
* created: 2024.12.07 15:07:54
*/
8 :
#include<bits/stdc++.h>
#define int long long
#define PII pair<int,int>
#define ULL unsigned long long
#define all(v) v.begin(), v.end()
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int N = 1 * 1e6 + 10,M = 5 * 1e3 + 10,inf = 0x3f3f3f3f;
void solve()
{
string s,ed = "LANQIAO";
cin >> s;
int idx = 0;
for(auto c : s)
{
if(c == ed[idx]) idx++;
if(idx == ed.size())
{
cout << "YES";
return;
}
}
cout << "NO";
}
signed main()
{
ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
int _=1;
// cin>>_;
while(_--)
{
solve();
}
return 0;
}
/**
* author: Nijika_jia
* created: 2024.12.07 15:08:55
*/
9 :
#include<bits/stdc++.h>
#define int long long
#define PII pair<int,int>
#define ULL unsigned long long
#define all(v) v.begin(), v.end()
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int N = 1 * 1e6 + 10,M = 5 * 1e3 + 10,inf = 0x3f3f3f3f;
int g[M][M];
void solve()
{
int n,m;
cin >> n >> m;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin >> g[i][j];
int ans = -inf;
for(int sti = 1; sti <= n; sti ++)
{
for(int stj = 1; stj <= m; stj ++)
{
for(int len = 1; ; len ++)
{
if(sti + len > n || stj + len > m) break;
int total = 0;
for(int j=stj;j<=stj+len;j++) total += g[sti][j];
// cout << '\n';
for(int i=sti+1;i<=sti+len;i++) total += g[i][stj];
// cout << '\n';
for(int j=stj+1;j<=stj+len;j++) total += g[sti+len][j];
// cout << '\n';
for(int i=sti+1;i<sti+len;i++) total += g[i][stj+len];
// cout << '\n' << '\n';
ans = max(total,ans);
}
}
}
cout << ans;
}
signed main()
{
ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
int _=1;
// cin>>_;
while(_--)
{
solve();
}
return 0;
}
/**
* author: Nijika_jia
* created: 2024.12.07 15:13:22
*/
10 :
#include<bits/stdc++.h>
#define int long long
#define PII pair<int,int>
#define ULL unsigned long long
#define all(v) v.begin(), v.end()
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int N = 1 * 1e6 + 10,M = 5 * 1e3 + 10,inf = 0x3f3f3f3f;
int n;
int dir[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};
string OP = "FLR";
set<PII> st;
string op;
struct Node
{
int x,y,d;
}node[N];
void go(char c,int &x,int &y,int &d)
{
if(c == 'F') x += dir[d][0] , y += dir[d][1];
else if(c == 'L')
{
d = (d+1)%4;
x += dir[d][0] , y += dir[d][1];
}
else
{
d --;
if(d < 0) d = 3;
x += dir[d][0] , y += dir[d][1];
}
}
void get_xy(int idx)
{
for(auto c : OP)
{
string t = op;
if(c!=t[idx])
{
t[idx] = c;
int x=node[idx].x, y = node[idx].y, d = node[idx].d;
for(int i=idx;i<n;i++)
{
go(t[i],x,y,d);
}
st.insert({x,y});
}
}
}
void solve()
{
cin >> n;
cin >> op;
int nowx=0,nowy=0,nowd = 2;
for(int i=0;i<n;i++)
{
node[i] = {nowx,nowy,nowd};
go(op[i],nowx,nowy,nowd);
}
for(int i=0;i<n;i++)
{
}
for(int i=0;i<n;i++)
{
get_xy(i);
}
// for(auto [x,y] : st) cout << x << ' ' << y << '\n';
cout << st.size() << '\n';
}
signed main()
{
ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
int _=1;
// cin>>_;
while(_--)
{
solve();
}
return 0;
}
/**
* author: Nijika_jia
* created: 2024.12.07 15:33:49
*/
- 已修改
- 3 次查看
- 举报
0 条评论
目前还没有评论...
152
已通过
0
题解被赞