Java教程

【2022neuoj刷题记录】

本文主要是介绍【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;
}

这篇关于【2022neuoj刷题记录】的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!