艺龙的第一个多线程为什么会时间超时????

有没有同城艺龙多线程的那个题 本地运行没问题。结果赛码时间超时。有没有一样的??#同程旅行##笔试时间#
全部评论
没有也,你的代码是怎样的呢?这是我的博客链接https://blog.csdn.net/qq_40859852/article/details/100145993,希望能对你有帮助。
点赞 回复
分享
发布于 2019-08-29 20:42
public class Main {   public class void main(String[] a) {    Scanner in = new Scanner(System.in);     String str = in.nextLine();      System.out.println(str + "_A_B_C");    } } 这样过可以吗?
点赞 回复
分享
发布于 2019-08-29 20:55
百信银行
校招火热招聘中
官网直投
同超时,本地通过了
点赞 回复
分享
发布于 2019-08-29 20:59
public class Main {     public static void main(String[] args) {         Scanner scanner = new Scanner(System.in);         String line = scanner.nextLine();         System.out.print(line);         scanner.close();                  for (int i = 0; i < 3; i++) {             new Print(i, "_" + (char)('A' + i)).start();         }     } } class Print extends Thread {     public static volatile int flag = 0;     private int id;     private String val;     public Print(int id, String val) {         this.val = val;         this.id = id;     }     @Override     public void run() {         while (true) {             if (id == flag) {                 System.out.print(val);                 flag++;                 return;             }         }     } } 没超时,通过
点赞 回复
分享
发布于 2019-08-29 21:20

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务