Java 中IO流&BufferedReader(读入单个字符或者数字)----&BufferedTokenizer--(读入数组或者数字)

//对标牛客竞赛小白月赛109 a题
//
import
java.util.*; import java.io.*; public class Main{ static long n; static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter wt = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args)throws Exception{ int t = nextInt(); while (t -- > 0){ n = nextLong(); if (n <= 2) wt.println(n); else { if ((n % 2) == 1) wt.println(3); else wt.println(2); } } wt.flush(); } public static int nextInt() throws Exception {//int型 return Integer.parseInt(bf.readLine()); } public static long nextLong() throws Exception {//long型 return Long.parseLong(bf.readLine()); } }

 

 

posted @ 2023-03-04 14:00  LILi2209  阅读(33)  评论(0)    收藏  举报