触宝笔试编程题真是呵呵哒

第二题
本地是对的,交上去0%

难道是我输出问题?
我直接输出

time=1.00;
distance=0.00;
printf("%.2f %.2f\n",time,distance);
 

也还是 0%啊。
全部评论
System.out.printf("%.2f %.2f",now,pre); System.out.println(); 这个输出有什么问题,为什么是0%,本地可以
点赞 回复 分享
发布于 2017-09-05 21:12
第一道题,Java怎么输出?while (in.hasNext()) ,本地调试输出没问题啊
点赞 回复 分享
发布于 2017-09-05 21:02
第一题本地对,交上去0,第二题应该是要算每个时刻中,距离最大的那个点对的距离在所有时刻中的最大距离是最小的。- -,31那个解是仅把第一个时刻的special_dot拿去解方程的结果
点赞 回复 分享
发布于 2017-09-05 21:02
0 0
点赞 回复 分享
发布于 2017-09-05 21:00
请问你有摄像头调试吗?我这边其实没用摄像头
点赞 回复 分享
发布于 2017-09-05 20:58
是不是没有摄像头啊,我的摄像头没开
点赞 回复 分享
发布于 2017-09-05 20:58
package Item; import java.text.DecimalFormat; import java.util.Scanner; public class Main {     public static float dis(float x1, float y1,float x2,float y2) { float dis = (float) Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); return dis; }     public static float diatanceMap(float[][] dots,float time) {     float maxDiatance =  0;     int n = dots.length;     float[][] dis = new float[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < i; j++){ dis[i][j] = dis(dots[i][0] + dots[i][2] * time,         dots[i][1] + dots[i][3] * time,         dots[j][0] + dots[j][2] * time,         dots[j][1] + dots[j][3] * time); maxDiatance = Math.max(dis[i][j], maxDiatance); } } return maxDiatance; } public static void main(String[] args) {         Scanner in = new Scanner(System.in);         while(in.hasNext()){         int n = in.nextInt();         float[][] dots = new float[n][4];         for(int i = 0; i < n; i++){         //x         dots[i][0] = in.nextInt();         //y         dots[i][1] = in.nextInt();         //vx         dots[i][2] = in.nextInt();         //vy         dots[i][3] = in.nextInt();         }         float min = 1000000000;         float time = 0;         float resultTime = 0;         while(time < 100){         float maxDiatance = diatanceMap(dots, time);         if(maxDiatance < min){         min = maxDiatance;         resultTime = time;          }         maxDiatance = 0;         time += 0.01;         }         DecimalFormat    df   = new DecimalFormat("######0.00");          System.out.println(df.format(resultTime) + " " + df.format(min));         }         System.out.println(); }  }
点赞 回复 分享
发布于 2017-09-05 20:56
第二题算出了61最短
点赞 回复 分享
发布于 2017-09-05 20:43
触宝第二题样例就有问题吧,第二个case 距离81怎么算出来的,我算出来是31点几。。时间是对的
点赞 回复 分享
发布于 2017-09-05 20:43
输出结果应该是3 2 1吧
点赞 回复 分享
发布于 2017-09-05 20:36
题第一题好像错误
点赞 回复 分享
发布于 2017-09-05 20:36
一样本地可以,提交上去0
点赞 回复 分享
发布于 2017-09-05 20:34
第一题呢也是这样?本地Ok,但是提交测试不通过。 你怎么样啊 第一题?
点赞 回复 分享
发布于 2017-09-05 20:33

相关推荐

深夜书店vv:腾讯是这样的,去年很多走廊都加桌子当工区
点赞 评论 收藏
分享
04-03 12:09
東京大学 C++
求求求求暑期offer:留第一行,剩下的不要
点赞 评论 收藏
分享
评论
1
5
分享

创作者周榜

更多
牛客网
牛客企业服务