【2022neuoj刷题记录】

最近neuoj加了一些atcoder的题,正好在刷题,存一下代码

2581

点击查看代码
//Author:Fczhao
//Language:cpp
#include <bits/stdc++.h>
using namespace std;
signed main(){
  #ifdef FCZHAO
  freopen("1.in", "r", stdin);
  freopen("1.out", "w", stdout);
  #endif
  ios::sync_with_stdio(false);
  int a[3];
  for(int i = 0; i < 3; i++) cin >> a[i];
  sort(a, a + 3, greater<int>());
  cout << a[0] * 10 + a[1] + a[2] << endl;
  return 0;
}

2582

点击查看代码
//Author:Fczhao
//Language:cpp
#include <bits/stdc++.h>
using namespace std;
signed main(){
  #ifdef FCZHAO
  freopen("1.in", "r", stdin);
  freopen("1.out", "w", stdout);
  #endif
  ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  vector<int> x(n + 1), y(m + 1);
  cin >> x[0] >> y[0];
  for(int i = 1; i <= n; i++) cin >> x[i];
  for(int i = 1; i <= m; i++) cin >> y[i];
  sort(x.begin(), x.end(), greater<int>());
  sort(y.begin(), y.end());
  if(x[0] < y[0]) cout << "No War" << endl;
  else cout << "War" << endl;
  return 0;
}

2583

点击查看代码
//Author:Fczhao
//Language:cpp
#include <bits/stdc++.h>
using namespace std;
signed main(){
  #ifdef FCZHAO
  freopen("1.in", "r", stdin);
  freopen("1.out", "w", stdout);
  #endif
  int n, a, b;
  cin >> n >> a >> b;
  if(n == 1) puts("Hello World");
  else cout << a + b << endl;
  return 0;
}

2584

点击查看代码
//Author:Fczhao
//Language:cpp
#include <bits/stdc++.h>
using namespace std;
bool solve() {
  string s, t;
  cin >> s >> t;
  int a[26], b[26];
  memset(a, -1, sizeof(a));
  memset(b, -1, sizeof(b));
  for(int i = 0; i < s.length(); i++) {
    if(a[s[i] - 'a'] == -1) a[s[i] - 'a'] = t[i] - 'a';
    if(b[t[i] - 'a'] == -1) b[t[i] - 'a'] = s[i] - 'a';
    if(a[s[i] - 'a'] != -1 && a[s[i] - 'a'] != t[i] - 'a') return false;
    if(b[t[i] - 'a'] != -1 && b[t[i] - 'a'] != s[i] - 'a') return false;
  }
  return true;
}
signed main(){
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}

上一篇:13 myBatis-05-高级ResultMap


下一篇:适配器模式