ZestfulYK的Blog

广工月赛

ZestfulYK的战绩

图片

比赛难度

中等,以基础题为主,拼尽全力战胜少量难题

部分代码

F

  • 分析
    很不错的博弈题目,使我的大脑旋转,最后打表做出来了

题目链接

代码

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n,m;
cin>>n>>m;
if(n==0&&m==0) cout<<"Bob"<<endl;
else if(n==1&m==0) cout<<"Alice"<<endl;
else if(n==2&m==0) cout<<"Bob"<<endl;
else if(n==3&m==0) cout<<"Bob"<<endl;
else if(n==0&m==1) cout<<"Alice"<<endl;
else if(n==0&m==2) cout<<"Bob"<<endl;
else if(n==0&m==3) cout<<"Alice"<<endl;//
else if(n==1&m==1) cout<<"Bob"<<endl;
else if(n==1&m==2) cout<<"Bob"<<endl;
else if(n==1&m==3) cout<<"Alice"<<endl;//
else if(n==2&m==1) cout<<"Bob"<<endl;
else if(n==2&m==2) cout<<"Bob"<<endl;
else if(n==2&m==3) cout<<"Alice"<<endl;//
else if(n==3&m==1) cout<<"Bob"<<endl;
else if(n==3&m==2) cout<<"Bob"<<endl;
else if(n==3&m==3) cout<<"Alice"<<endl;
}

J

  • 分析
    这题目也不错,但其实看代码找规律就行了

题目链接

代码

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n; cin>>n;
ll s=sqrt(n);
if(s*s!=n) s++;
ll last=n%s;
for(int i=last;i>=1;i--) cout<<i<<" ";
for(int j=1;j<=n/s;j++){
for(int i=last+j*s;i>last+(j-1)*s;i--) cout<<i<<" ";
}
}