ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

【2022neuoj刷题记录】

2022-01-13 23:34:43  阅读:159  来源: 互联网

标签:false cout 记录 2022neuoj Author cin int freopen 刷题


最近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;
}

标签:false,cout,记录,2022neuoj,Author,cin,int,freopen,刷题
来源: https://www.cnblogs.com/fczhao/p/neuoj-atcoder.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有