ICode9

精准搜索请尝试: 精确搜索
  • 2022.09.022022-09-03 17:32:45

    Codeforces Round #818 (Div. 2) 赛时:476+904+1176+930+0+0 补题:476+904+1176+930+600+0 A. Madoka and Strange Thoughts 求满足 \(a,b\leq n\) 且 \(\frac{lcm(a,b)}{gcd(a,b)}\leq 3\) 的个数。 \(n\leq 10^8,t\leq 10^4\) 。 赛时打表 \(1\) 分钟看出规律,设差分序列 \(b_i=

  • 龟兔赛跑22022-07-24 15:04:30

    package Runnable1;//模拟龟兔赛跑public class Race implements Runnable{ //胜利者 private static String winner; @Override public void run() { for (int i = 0; i <=100; i++) { //模拟兔子休息 if (Thread.currentThrea

  • 擅长使用iter2022-06-25 09:31:22

    def populate_ranks(votes, ranks): names = list(votes.keys()) names.sort(key=votes.get, reverse=True) for i, name in enumerate(names, 1): ranks[name] = i def get_winner(ranks): return next(iter(ranks)) if __name__ == '__mai

  • LeeCode 1832 找出游戏的获胜者2022-05-04 16:03:06

    LeeCode 1832 题目描述: 共有 n 名小伙伴一起做游戏。小伙伴围成一圈,按顺时针顺序从1到n编号。确切地说,从第 i 名小伙伴顺时针移动一位会到达第 (i+1) 名小伙伴的位置,其中 1 <= i < n,从第 n 名小伙伴顺时针移动一位会回到第 1 名小伙伴的位置。 游戏遵顼如下规则: 从第 1 名小伙伴

  • 龟兔赛跑2022-02-04 14:01:29

    首先来个赛道距离,然后要离终点越来越近 判断比赛是否结束 打印出胜利者 龟兔赛跑开始 故事中是乌龟赢的,兔子需要睡觉,所以我们来模拟兔子睡觉 终于,乌龟赢得比赛 package com.wang.multiThread; //模拟龟兔赛跑 public class Race implements Runnable { //胜利者 privat

  • 龟兔赛跑(初学线程)2022-01-14 13:35:01

    import java.awt.geom.FlatteningPathIterator;public class Race implements Runnable{ public static String winner; public static void main(String[] args) { Race race =new Race(); new Thread(race,"兔子").start(); new Thread

  • Java并发初识2022-01-03 16:02:38

    并发初识 案例:实现一个抢火车票的案例demo package com.thread; // 多线程同时操作同一个对象 // 买火车票的例子 // 发现问题:多线程操作同一个资源的情况下,线程不安全,数据紊乱 public class TestThread4 implements Runnable { // 票数 private int ticketNums = 10;

  • 多线程之龟兔赛跑2022-01-02 17:05:43

    //模拟龟兔赛跑 public class Race implements Runnable { //胜利者 private static String winner; @Override public void run() { for (int i = 1; i < 101; i++) { //模拟兔子休息 if(Thread.currentThread().getName().e

  • 【CF2A Winner】题解2021-12-20 19:03:40

    题目链接 题目 The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes mor

  • 使用龟兔赛跑模拟多线程切换2021-12-13 14:32:36

    package 线程;public class Race implements Runnable{ //龟兔赛跑 //胜利者 private static String winner; @Override public void run() { for (int i = 0; i <= 100; i++) { //模拟兔子休息 if (Thread.currentThread().getName(

  • 多线程模拟龟兔赛跑(兔子睡觉)2021-12-04 19:04:34

    public class race implements Runnable{ //只能有一个赢家,所以这里winner是静态属性 private static String winner; @Override public void run() { for (int i = 0; i < 100; i++) { if(Thread.currentThread().getName().equals("兔子"

  • c++ string类2021-11-07 21:31:46

    一.string类的构造函数 1.需要用到的头文件 #include<iostream> #include<string> using namespace std; 2. 函数实例 string one("Lottery Winner!"); //直接将字符串赋值给string类 cout << one << endl; //Lottery Winner!

  • 猜数字2021-10-19 18:35:42

    一群人坐在一起,每人猜一个 100 以内的数,谁的数字最接近大家平均数的一半就赢。本题就要求你找出其中的赢家。 输入格式: 输入在第一行给出一个正整数N(≤104)。随后 N 行,每行给出一个玩家的名字(由不超过8个英文字母组成的字符串)和其猜的正整数(≤ 100)。 输出格式: 在一行中顺序输出:大家

  • 并发问题之龟兔赛跑2021-10-14 19:57:57

    为了方便理解,自己敲了一边代码,记录 b站 狂神笔记。 /* 多线程 方法1:继承Thread类,重写run()方法,调用start方法 方法2.实现Runnable接口,重写run()方法,new一个Thread方法,放进Runnable的对象,调用start方法 一般推荐第二种,能通过继承实现多个对象的同步 */ //龟兔赛跑小案例 pu

  • 多线程案例:龟兔赛跑-Race2021-07-19 18:33:39

    多线程案例:龟兔赛跑-Race 前置条件: 首先来个赛道距离,然后要离终点越来越近 判断比赛是否结束 打印出胜利者 龟兔赛跑开始 故事中是乌龟赢了,兔子需要睡觉,所以我们来模拟兔子睡觉 乌龟赢得比赛 代码: package multithreading; // 模拟龟兔赛跑 public class Race implements Runna

  • 【python】实验1项目3 文件的读写,编码和解码2021-07-03 22:07:01

    文件的读写,编码和解码 小练习1:# 1.分别使用gbk和utf-8编码自己的名字,并将其打印出来。 # 2.复制上一步得到的结果,进行解码,打印出你的名字(两次)。3.使用gbk解码:b’\xb4\xf3\xca\xfd\xbe\xdd2018\xbc\xb6\xbf\xba\xb0\xef\xd7\xd3’ 小练习2:通过文件读写命令,读取 photo1 里的数

  • 02案例龟兔赛跑2021-06-26 22:30:25

    案例:龟兔赛跑 首先来个赛道距离,然后要离终点越来越近判断比赛是否结束打印出胜利者龟兔赛跑开始故事中时乌龟赢的,兔子需要睡觉,所以我们来模拟兔子睡觉终于,乌龟赢得比赛 package edu.wzw.Thread; public class Race implements Runnable{ private static String Winner;

  • 龟兔赛跑2021-06-05 17:03:31

    package cn.ruhsang.demo01;//模拟龟兔赛跑public class Race implements Runnable{ //胜利者 private static String winner; @Override public void run() { for (int i = 0; i <=100 ; i++) { //模拟兔子睡觉 if(Thread.currentThrea

  • 多线程部分笔记2021-05-21 14:01:59

    基本概念 多任务: 同时干多件事情,例如:吃饭玩儿手机,上厕所玩儿手机 多线程: 原来是单车道,但是车越来越多了 所以拓宽了到了 变成了多车道 ,不会出现拥堵的情况 进程 在操作系统中运行的程序就是进程 ,音乐 视频等.是系统资源分配的单位 线程 看电视时同时进行的声音,字幕,图像

  • 龟兔赛跑问题(并发)2021-04-30 21:02:14

    并发思想实现龟兔赛跑问题,龟兔相当于两个线性同时执行 //龟兔赛跑 并发问题 public class Race implements Runnable{ private static String winner;//定义获胜方,只有一名 @Override public void run() { //模拟赛道长100 for (int i = 0; i <

  • 2021.1.23--vj补题2021-01-26 20:01:22

    B - B  CodeForces - 879B  n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They p

  • 多线程——龟兔赛跑问题2020-12-20 11:01:49

    龟兔赛跑 100米两条线程 一个乌龟 一个兔子 如果是兔子的话设置延迟函数 当有一方胜出 马上跳出循环 ==>比赛终止 package Lesson_Thread; public class Race implements Runnable { private static String winner; @Override public void run() { //开始跑步

  • 评选最牛群主v1.0(哈工大Mooc)2020-11-29 09:03:28

    Mooc课后习题集 及 做到的一些有趣的题 这是我初学c开始有意识的记录自己做的每一道题开始写下的代码水平 一个一个代码发出来 直到我现在学的数据结构 那个时候还不会注释 格式什么的也是按照自己怎么喜欢怎么来 如果真不会看会代码理解一下 qwq 如代码有错请见谅 毕竟都好

  • Predict the Winner2020-09-01 08:33:04

    Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a number, that number will not be available for the next

  • [洛谷P1290][题解]欧几里德的游戏2020-05-17 18:06:05

    一个蒟蒻的肺腑之言:感觉博弈论的黄题比平衡树的紫题还要难呢呜呜呜(还不是因为太蒟) 0.题意 现在有两个数,两个人轮流玩游戏,每次从较大数中取出若干较小数的倍数,取到0者获胜。 给出两个数,问在两人都采用最优策略的情况下谁能赢。 1.思路 博弈论自然要考虑必胜态和必败态。(以下抄一段

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有