拼多多笔试题第一题输入错误是为什么呀?
携程和拼多多,都是为了acm输入输出痛苦orz。
我的输入输出是这样的,语言是java:
* public static void main(String[] args) {
* Scanner in = new Scanner(System.in);
* while (in.hasNext()) {
* //只有可能理论上已经读完了关卡,要到下一个去了,却到了关卡里面……
* int n = in.nextInt();
* int m = in.nextInt();
* int[][] nums = new int[n][3];
* for(int i = 0; i < n; i++) {
* // 给的是字符还是字符串啊
* String s = in.next();
* nums[i][0] = s.charAt(0);
* nums[i][1] = in.nextInt();
* nums[i][2] = nums[i][0] - 'm' == 0? in.nextInt() : 0;
* }
* System.out.println(solution(nums));
* }
* }
不知道会不会乱码,放上图片:
我的输入输出是这样的,语言是java:
* public static void main(String[] args) {
* Scanner in = new Scanner(System.in);
* while (in.hasNext()) {
* //只有可能理论上已经读完了关卡,要到下一个去了,却到了关卡里面……
* int n = in.nextInt();
* int m = in.nextInt();
* int[][] nums = new int[n][3];
* for(int i = 0; i < n; i++) {
* // 给的是字符还是字符串啊
* String s = in.next();
* nums[i][0] = s.charAt(0);
* nums[i][1] = in.nextInt();
* nums[i][2] = nums[i][0] - 'm' == 0? in.nextInt() : 0;
* }
* System.out.println(solution(nums));
* }
* }
不知道会不会乱码,放上图片:
全部评论
我这题也就写了输入输出
第一行后面后面有个'\n',nextInt不会读\n,需要用nextLine读
我都是一行一行读的
相关推荐
点赞 评论 收藏
分享
2025-11-23 20:47
中国地质大学(武汉) Java
程序员牛肉:继续沉淀吧同学,你这就是纯纯的流水线产品。
差不多的学历+两个烂大街项目。自身学历又不行,现在找啥实习呢。有点太浮躁了。多花点心思搞搞ai,开源和八股。这比你这段时间捣鼓一段小厂实习要好得多; 点赞 评论 收藏
分享
点赞 评论 收藏
分享
查看9道真题和解析