A.苯的九宫格
签到题
Code:
#include<bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << ": " << x << '\n'; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int a[10] = {0}; for (int i = 1; i <= 9; i++) { cin >> a[i]; } string s; cin >> s; for (char c : s) cout << a[c - '0']; return 0; }
B.小苯的好数组
思路:
如果一个数组按升序排序后和原来不完全相同, 也就是说如果这个数组本身就是升序那么输出0,否则就是这个数组原本的长度
Code:
#include<bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << ": " << x << '\n'; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> a(n); for (int &i : a) cin >> i; cout << (is_sorted(a.begin(), a.end()) ? 0 : n) << '\n'; return 0; }
标签:cout,namespace,牛客,数组,小白月赛,升序,include,94,define From: https://www.cnblogs.com/youhualiuh/p/18211747