样例 2 数据错误

P2655 2038年问题

我也想问,为什么我用Java的 `LocalDateTime` 跑出来的结果比样例秒数少1 ```java import java.io.*; import java.time.LocalDateTime; import java.util.*; public class Main { static BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter cout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); static StreamTokenizer st = new StreamTokenizer(buf); public static int nextInt() throws IOException { st.nextToken(); return (int) st.nval; } public static String nextLine() throws IOException{ String line = buf.readLine(); while(line.isEmpty()) line = buf.readLine(); return line; } static int n,m,k,l; static int[] head,vis; static int cnt=0,tot=0; static final int INF = 0x3f3f3f3f; public static void main(String[] args) throws IOException { int t = nextInt(); while(t-->0){ n = nextInt(); int totSe = (int)Math.pow(2,n-1)-1; int year = nextInt(); int month = nextInt(); int day = nextInt(); int hour = nextInt(); int minute = nextInt(); int second = nextInt(); LocalDateTime base = LocalDateTime.of(year, month, day, hour, minute, second); base = base.plusSeconds(totSe); cout.printf("%d %d %d %d %d %d\n",base.getYear(),base.getMonth().getValue(), base.getDayOfMonth(),base.getHour(),base.getMinute(),base.getSecond()); } cout.flush(); }// End of main } ```
by KKKZOZ @ 2023-03-19 17:22:59


|