2023届米哈游秋招-平台后端第1批
编程题1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| import java.util.Scanner;
public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str = scanner.nextLine(); char[] html = str.toCharArray(); int len = html.length; int ans = 0, cnt = 0; String open = "<div>", close = "</div>"; for (int i = 0; i < len; i++) { if (html[i] == '<') { if (len - i >= 5) { if (str.substring(i, i+5).equals(open)) { cnt++; } } if (len - i >= 6) { if (cnt>0 && str.substring(i, i+6).equals(close)) { cnt--; ans++; } } } } System.out.println(ans); } }
|
编程题2
编程题3
我发现我应该不适合做游戏开发,还是老老实实投Java后端吧:cry: