西南民族大学2023天梯选拔赛
西南民族大学2023天梯选拔赛
题目列表 - 编程题 - 西南民族大学2023天梯选拔赛 (pintia.cn)
L1-1 谢谢卡尔!
签到题
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
using namespace std;
#define ll long long
const int N = 2e5 + 7;
const int mod = 10007;
int a[N];
int b[N];
int v[N];
int f[105][N];
void solve(){
cout << "谢谢卡尔!\\(>_<)/";
}
int main() {
ios::sync_with_stdio(false);
cout.tie(nullptr),cin.tie(nullptr);
int _ = 1; //cin >> _;
while (_--){
solve();
}
}
L1-2 现在是,幻想时间!
模拟题
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <iomanip>
using namespace std;
#define ll long long
const int N = 2e5 + 7;
const int mod = 10007;
int a[N];
int b[N];
int v[N];
int f[105][N];
void solve(){
double n,t;cin >> n >> t;
cout << fixed << setprecision(3) << n / t << endl;
}
int main() {
ios::sync_with_stdio(false);
cout.tie(nullptr),cin.tie(nullptr);
int _ = 1; //cin >> _;
while (_--){
solve();
}
}
L1-3 你是来陪可莉炸鱼的吗?
模拟
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <iomanip>
#include <map>
using namespace std;
#define ll long long
const int N = 1e3 + 7;
const int mod = 10007;
int a[N];
int b[N];
int v[N];
int f[N];
void solve(){
int n;cin >> n;
ll res = 0;
for (int i = 1; i <= n; ++i){
ll x;cin >> x;
if (x < 100)res += 1;
else if(x >= 100 && x < 200)res += 2;
else if(x < 300 && x >=200)res += 5;
else if(x >= 300 && x < 400)res += 10;
else res += 15;
}
cout << res;
}
int main() {
ios::sync_with_stdio(false);
cout.tie(nullptr),cin.tie(nullptr);
int _ = 1; //cin >> _;
while (_--){
solve();
}
}
L1-4 扫雷游戏
暴力模拟,范围很小
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <iomanip>
#include <map>
using namespace std;
#define ll long long
const int N = 1e3 + 7;
const int mod = 10007;
int b[N];
char a[20][20];
char res[20][20];
int n,m;
int dx[] = {-1,-1,-1,0,0,0,1,1,1};
int dy[] = {-1,0,1,-1,0,1,-1,0,1};
int check(int x,int y){
int bc = 0;
for (int i = 0;i < 9;i++){
int u = x + dx[i],v = y + dy[i];
if (u < 1 || u > n || v < 1 || v > m)continue;
if (a[u][v] == '*')bc++;
}
return bc;
}
void solve(){
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)
for (int j = 1; j <= m; ++j){
if (a[i][j] == '*'){
res[i][j] = '*';
continue;
}
int d = check(i,j);
if (d == 0)res[i][j] = '.';
else