试了好多次,无论怎么写java像不是超内存就是超时

P1567 统计天数

自己写输入试试
by officeyutong @ 2018-01-05 12:44:01


我也是java,感觉算法没问题,也没用数组,就是数据量大时超时
by amysue @ 2018-01-14 21:19:13


```cpp public static void main(String[] args) { Scanner cin = new Scanner(System.in); int N = cin.nextInt(); int i = 0; int last = Integer.MAX_VALUE; int tempDays = 0; int days = 0; int j = 0; while (i < N) { j = cin.nextInt(); if (j <= last) { if (tempDays > days) { days = tempDays; } tempDays = 1; }else { tempDays++; } last = j; i++; } if (tempDays > days) { System.out.println(tempDays); }else { System.out.println(days); } } ```
by amysue @ 2018-01-14 21:20:48


是不是Java的Scanner太慢了TAT我也是5个TLE
by 数据攻城狮 @ 2018-01-17 13:37:32


|