Aperture_Science level
获赞
373
粉丝
6
关注
4
看过 TA
5
这还是秘密~
2019
Java
IP属地:未知
暂未填写个人简介
私信
关注
2018-09-26 11:48
这还是秘密~ Java
😂头条效率还是高呀
投递字节跳动等公司10个岗位
0 点赞 评论 收藏
分享
2018-09-06 21:23
这还是秘密~ Java
第一题,看了之后就放弃了……   第二题,暴力解决,TLE,91%……      之后再看第一题,还是没有思路……   心态爆炸之后就交卷了……   凉了呀……
Aperture_S...:附上我的暴力代码 public class Main { static int[] count = new int[100000+1]; static LinkedList<Integer> queue= new LinkedList<>(); static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); int k = sc.nextInt(); int t = sc.nextInt(); int res = 0; boolean first = true; int lastNum = 0; for(int i = 0; i < k; i++) { int temp = sc.nextInt(); queue.offer(temp); count[temp]++; //System.out.println(count[temp]); if(first && count[temp] >= t) { res++; first = false; lastNum = temp; } } for(int i = k; i < n; i++) { int last = queue.poll(); count[last]--; int temp = sc.nextInt(); queue.offer(temp); count[temp]++; if(count[lastNum] >= t) { res++; continue; } if(count[temp] >= t) { res++; lastNum = temp; continue; } if(count[last] >= t) { res++; lastNum = last; continue; } Iterator<Integer> it = queue.iterator(); while(it.hasNext()) { int num = it.next(); if(count[num] >= t) { res++; lastNum = num; break; } } } System.out.println(res); } }
投递美团等公司10个岗位
0 点赞 评论 收藏
分享
2018-08-31 16:56
这还是秘密~ Java
冷静理智如我:为什么我的第一反应是图片清晰度好高啊~
0 点赞 评论 收藏
分享

创作者周榜

更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务