2025届北华大学新生赛题解
有趣的回文字符串
https://ac.nowcoder.com/acm/contest/119449/A
锐评
在此,我谨向各方致以诚挚的感谢:首先,衷心感谢北华ACM程序设计工作室出题组的精心筹备,是你们的专业与用心为活动奠定了优质基础;同时,感谢各位老师的悉心指导与鼎力支持,为我们提供了宝贵的方向与保障;也感谢牛客平台提供的优质展示与实践空间,让想法得以落地、交流得以实现;最后,特别感谢给予我验题的机会,这份信任与认可让我倍感荣幸。
验题报告
这套题个人感觉是比较好的。难度也是适合北华新生体质。
N 是发现了数据的错误
剩下的没有什么问题
题目A:有趣的回文字符串
要会的还是十进制到任意进制的转化
这题是力扣原题
*********************************************************
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo long n = sc.nextLong(); for(int i = 2; i <= n-2; i++) { String s = numberToBase(n, i); // System.out.println(s); if(s.equals(new StringBuilder(s).reverse().toString())==false) { System.out.println("NO"); return; } } System.out.println("YES"); } /** * 将一个长整数转换为指定进制的字符串表示。 * * @param n 要转换的长整数 * @param b 目标进制,必须大于等于2 * @return 转换后的字符串表示 */ public static String numberToBase(long n, long b) { if (n == 0) { return "0"; } StringBuilder sb = new StringBuilder(); while (n > 0) { sb.append(n % b); n = n / b; } return sb.reverse().toString(); } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目B:扫雷启动
实际上我并没有读懂题目
可以参考 新生这位同学的做法
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=1e3+10; const int M=2e6+10; int n,m; int a[N][N],v[N][N]; struct pt { int x,y; }lin[M]; int tot; void dfs(int x,int y) { if(x<1||x>n||y<1||y>m) return; if(v[x][y]) return; if(a[x][y]!=2) return; v[x][y]=1; if(a[x][y]!=2) return; dfs(x+1,y-1); dfs(x+1,y); dfs(x+1,y+1); dfs(x,y+1); dfs(x,y-1); dfs(x-1,y+1); dfs(x-1,y); dfs(x-1,y-1); } int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { char c; cin>>c; if(c=='*') a[i][j]=-1; else if(c=='.') { a[i][j]=2; lin[++tot].x=i; lin[tot].y=j; } else a[i][j]=1; } } int ans=0; for(int i=1;i<=tot;i++) { int x2=lin[i].x,y2=lin[i].y; if(v[x2][y2]) continue; dfs(x2,y2); ans++; } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(a[i][j]==1&&!v[i][j]) ans++; } } printf("%d",ans); // for(int i=1;i<=n;i++) // { // for(int j=1;j<=m;j++) // { // printf("%2d",a[i][j]); // } // printf("\n"); // } // 4 4 // 111. // 1*1. // 111. // .... return 0; }
题目C:X
经典的读入和读出
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo String next1 = sc.next(); String next2 = sc.next(); System.out.println(next2); System.out.println(next1); } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目D:道阻且长(2)
这题是有一个数学结论
已知任何数除 7 要不是 6 个一循环要不是除尽
试一试就知道了
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo // System.out.println((double) 1/(double)7); // System.out.println((double) 2/(double)7); // System.out.println((double) 3/(double)7); // System.out.println((double) 4/(double)7); // System.out.println((double) 5/(double)7); // System.out.println((double) 6/(double)7); // System.out.println((double) 7/(double)7); // System.out.println((double) 8/(double)7); // System.out.println((double) 9/(double)7); // System.out.println((double) 10/(double)7); // System.out.println((double) 11/(double)7); // System.out.println((double) 12/(double)7); long n=sc.nextLong(); if(n%7==0){ dduoln("0"); }else { dduoln("6"); } } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目E:王+{"中","大","超大"}+凡
用一个变量 cnt 去模拟每一次上下车的人数
cnt 代表的是当前车上的人数
循环 n 次
每次 cnt - a 下车 cnt + b 上车
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo int n = sc.nextInt(); long cnt=0; for (int i = 0; i < n - 1; i++) { long a=sc.nextLong(); long b=sc.nextLong(); cnt-=a; cnt+=b; } dduoln(cnt); } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目F:百思不得其解
// 今天早上和Litar打了一把 csgo 被 Litar 狠狠带飞了
简单判断
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo double n = sc.nextDouble(); double ans = n * 199 * 0.01; ans=Math.floor(ans); // System.out.println(ans); if(ans>=100){ dduoln("-1"); }else{ dduoln((int)(100-ans)); } } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目G:道阻且长(1)
简单判断
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo int a=sc.nextInt(); int b=sc.nextInt(); int c=sc.nextInt(); if(c<=a||b<=a){ dduoln("Yes"); }else { dduoln("No"); } } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目H:香蕉与猴(easy)
试一下 答案是 n/3
因为最优解是根据三个时间单位把整个长度分成三部分
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo long n = sc.nextLong(); System.out.println(n/3); } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目I:道阻且长(3)
简单循环
可能会涉及到双列集合相关。
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo int n=sc.nextInt(); int m=sc.nextInt(); int k=sc.nextInt(); long arr[]=new long[n]; for(int i=0;i<n;i++){ arr[i]=sc.nextLong(); } Arrays.sort(arr); int pi=0; int pj=n-1; long cnt=0; for (int i = 0; i < k; i++) { if(m>0){ m--; cnt+=1000000007-arr[pi]; pi++; }else { cnt+=arr[pj]; pj--; } } dduoln(cnt); } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目J:切西瓜?no!cake!
每次都变成原来两倍
出题人是个人才
木木三是个人才
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); BigInteger n = sc.nextBigInteger(); BigInteger i = BigInteger.ZERO; BigInteger floor = new BigInteger(1+""); while (floor.compareTo(n) < 0) { floor = calculate(floor); i = i.add(BigInteger.ONE); } System.out.println(i); sc.close(); } private static BigInteger calculate(BigInteger i) { return i.multiply(new BigInteger(2+"")); } }
题目K:拿石子
思维
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = 1; // t = scanner.nextInt(); while (t-- > 0) { solve(scanner); } scanner.close(); } static void solve(Scanner scanner) { long n = scanner.nextLong(); if(n%5!=0){ System.out.println("YES"); }else{ System.out.println("NO"); } } }
题目L:蜂蜜水
思维
import java.util.Scanner; public class Main { static int[] dx = {-1, 1, 0, 0, -1, -1, 1, 1}; static int[] dy = {0, 0, -1, 1, -1, 1, -1, 1}; static final int maxN = 200000 + 10; static final int mod = 1000000000 + 7; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = 1; // t = scanner.nextInt(); while (t-- > 0) { solve(scanner); } scanner.close(); } static void solve(Scanner scanner) { long a = scanner.nextLong(); long n = scanner.nextLong(); long l = scanner.nextLong(); if (n == 1) { System.out.println("Yes"); } else { if (n > a) { System.out.println("NO"); } else if (((a - l) / (n - 1)) * 2 < l) { System.out.println("NO"); } else { System.out.println("Yes"); } } } }
题目M:根
枚举 便利 乘
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo String str = sc.next(); char[] charArray = str.toCharArray(); int p_first = 0 ; int p_last = str.length()-1 ; long cnt=0; long t = str.length(); long add = str.length() - 2; while (p_first <= p_last){ if(p_last != p_first ){ cnt+= (charArray[p_first]-'0')*t; cnt+= (charArray[p_last]-'0')*t; // System.out.println(charArray[p_first]-'0'+" "+t); // System.out.println(charArray[p_last]-'0'+" "+t); }else { cnt+= (charArray[p_first]-'0')*t; // System.out.println(charArray[p_first]-'0'+" "+t); } // System.out.println(cnt); t+=add; add-=2; p_first++; p_last--; // System.out.println("point:"+p_first+" "+p_last); } dduoln(cnt); } public static void main(String[] args) throws Exception { int t = 1; t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
题目N:烟花易逝
双列集合
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { static IoScanner sc = new IoScanner(); static final int mod = (int) (1e9 + 7); // static final int mod = (int) (1e9 + 7); static int n; static int arr[]; static boolean visited[]; static ArrayList<ArrayList<Integer>> adj = new ArrayList<>(); /** * @throws IOException */ private static void solve() throws IOException { // todo HashMap<Character, Character> hm = new HashMap<>(); int n=sc.nextInt(); for (int i = 0; i < 3; i++) { char ch = sc.next().charAt(0); char ch1 = sc.next().charAt(0); hm.put(ch, ch1); } char arr[][]=new char[3][n]; for (int i = 0; i < 3; i++) { String ch = sc.next(); arr[i]=ch.toCharArray(); } for (int i = 0; i < 3; i++) { for (int i1 = 0; i1 < n; i1++) { System.out.print(hm.get(arr[i][i1])); } System.out.println(); } } public static void main(String[] args) throws Exception { int t = 1; // t = sc.nextInt(); while (t-- > 0) { solve(); } } static <T> void dduo(T t) { System.out.print(t); } static <T> void dduoln() { System.out.println(""); } static <T> void dduoln(T t) { System.out.println(t); } } /** * IoScanner类 * * @author Dduo * @version 1.0 * @description 通过IO流操作缓冲区减少了与底层输入输出设备的交互次数,旨在简化 Java 中的标准输入读取操作。 */ class IoScanner { BufferedReader bf; StringTokenizer st; BufferedWriter bw; public IoScanner() { bf = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public String nextLine() throws IOException { return bf.readLine(); } public String next() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } public char nextChar() throws IOException { return next().charAt(0); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public float nextFloat() throws IOException { return Float.parseFloat(next()); } public BigInteger nextBigInteger() throws IOException { return new BigInteger(next()); } public BigDecimal nextDecimal() throws IOException { return new BigDecimal(next()); } }
引流
牛客网
https://www.nowcoder.com/users/619886673
csdn
https://blog.csdn.net/qq_30500575?type=blog
github
微信公众号
欢迎大家来到北华大学,未来的世界无比精彩,请尽情享用!