RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题

全部问题

Martin Hope
null
Asked: 2025-03-07 04:14:27 +0000 UTC

如何提供填充,但使边框底部不移动?

  • 5

如何赋予padding元素项,但又使其border-bottom不向内移动?没有拐杖和伪元素,这能做到吗?如何做到?悬停可以正常工作,占据整个块,但border-bottom不想item-info占据整个块。

它应该是这样的,如在“选定的消息”项中: 在此处输入图片描述

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

li {
  list-style: none;
}

.list {
  background-color: green;
}

.item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 15px;
}

.item:hover {
  background-color: rgb(0 0 0 / 30%);
}

.icon {
  display: inline-block;
  width: 25px;
  height: 25px;
  background-color: red;
}

.item-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  gap: 25px;
  width: 100%;
  border-bottom: 2px solid #000;
}

.item-details {
  display: flex;
  align-items: center;
  gap: 5px;
}
<ul class="list">
  <li class="item">
    <div class="icon">
      <span></span>
    </div>
    <div class="item-info">
      <div class="item-name">Text</div>
      <div class="item-details">
        <span class="item-details__name">Details</span>
        <div class="icon">
          <span></span>
        </div>
      </div>
    </div>
  </li>
  <li class="item">
    <div class="icon">
      <span></span>
    </div>
    <div class="item-info">
      <div class="item-name">Text</div>
      <div class="item-details">
        <span class="item-details__name">Details</span>
        <div class="icon">
          <span></span>
        </div>
      </div>
    </div>
  </li>
</ul>

html
  • 1 个回答
  • 40 Views
Martin Hope
Николай Коптев
Asked: 2025-03-07 03:02:07 +0000 UTC

在图中进行深度优先搜索。 Yandex 竞赛(已解决)

  • 5

当发送问题解决方案进行验证时,验证系统会通知您答案不正确。 任务正文:

给定一个无向图,可能存在环路和多条边。需要找到一个包含数字为 1 的顶点的连通分量。

输入格式

第一行包含两个整数N(1≤N≤10^3)和M(0≤M≤5×10^5)——表示图中顶点和边的数量。接下来的 M 行列出了边 - 定义连接边的顶点的数量的数字对。顶点从一开始编号。

输出格式

在第一行中,打印数字 K——连接组件中的顶点数。在第二行中,打印 K 个整数 - 连通分量的顶点,按数字升序排列。

内存限制:256 MB


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class GraphTraversal {

    public static void main(String[] args) {
        try(BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int[] graphMetaData = Arrays.stream(reader.readLine().split("\\s")).mapToInt(Integer::valueOf).toArray();
            int n = graphMetaData[0];
            int m = graphMetaData[1];
            int start = 1;
            if(m > 0) {
                Set<Integer> visited = new HashSet<>();
                Map<Integer, Set<Integer>> graph = new HashMap<>(n);
                for(int i = 0; i < m; i++) {
                    int[] nodeData = Arrays.stream(reader.readLine().split("\\s")).mapToInt(Integer::valueOf).toArray();
                    int node1 = nodeData[0];
                    int node2 = nodeData[1];
                    addNodesInGraph(graph, node1, node2);
                }
                travel(graph, start, visited);
                print(visited);
            } else {
                System.out.println(1);
                System.out.println(1);
            }
        } catch(IOException e) {
            e.printStackTrace();
        }
    }
    
    private static void addNodesInGraph(Map<Integer, Set<Integer>> graph, int node1, int node2) {
        graph.computeIfAbsent(node1, k -> new HashSet<Integer>()).add(node2);
        graph.computeIfAbsent(node2, k -> new HashSet<Integer>()).add(node1);
    }
    
//  Alternative way by recursion
    private static void travel(Map<Integer, Set<Integer>> graph, int node, Set<Integer> visited) {
        visited.add(node);
        for(int neighbour : graph.getOrDefault(node, Collections.emptySet())) {
            if(!visited.contains(neighbour)) {
                travel(graph, neighbour, visited);
            }
        }
    }
    
//  Alternative way by queue
//  private static void travel(Map<Integer, Set<Integer>> graph, int start, Set<Integer> visited) {
//      Queue<Integer> noVisited = new LinkedList<>();
//      noVisited.add(start);
//      while(noVisited.size() > 0) {
//          int node = noVisited.remove();
//          if(!visited.contains(node)) {               
//              Set<Integer> neighbours = graph.getOrDefault(node, Collections.emptySet());
//              noVisited.addAll(neighbours);
//              visited.add(node);
//          }
//      }
//  }
    
    private static void print(Set<Integer> visited) {
        List<Integer> result = new ArrayList<>(visited);
        result.sort(Comparator.naturalOrder());
        System.out.println(visited.size());
        System.out.println(result.stream().map(String::valueOf).collect(Collectors.joining(" ")));
    }
}
java
  • 2 个回答
  • 68 Views
Martin Hope
Yulia
Asked: 2025-03-06 23:58:55 +0000 UTC

为什么函数式编程还没有流行起来?

  • 7

重要提示:我问这个问题是因为其他 stackoverflow 问题未能具体回答我下面描述的部分。

我完全不同意其他问题中的说法以及对软件开发中缺乏函数式语言的解释:

历史原因(时间已经过去很久了,函数式语言已经存在不同的变体,用于不同的目的和任务;现在它不再像 90 年代或 80 年代那样新颖),

性能较差(我们现在有的语言(比如 Java)被转换成字节码并由虚拟机运行。在这种情况下使用函数式语言真的太耗资源了吗?),

该领域缺乏发展(再次重申,这是胡说八道,我在许多问题中都看到了这一点。那么 Haskell 以及一堆在错误方面做大量工作的不同语言方言又如何呢?)。

我唯一能指出的一点是缺乏专家。没有人对这一论点提出异议。确实,对于企业来说这是一个巨大的减分项。

haskell
  • 1 个回答
  • 114 Views
Martin Hope
steep
Asked: 2025-03-06 22:36:35 +0000 UTC

如何在电报中制作按钮?

  • 5

电报机器人现在有 3 个按钮,单击后,它们会在聊天中写入简单的文本。如何制作 4 个按钮,但将它们排列成一行中的 2 个?点击第一个按钮/help,会显示另外 4 个按钮,就像一个多级菜单。

在此处输入图片描述

$data = file_get_contents('php://input');
$data = json_decode($data, true);
 
if (empty($data['message']['chat']['id'])) {
    exit();
}
 
define('TOKEN', '7444555:AAHomfgjN0mM');
 
// Функция вызова методов API.
function sendTelegram($method, $response)
{
    $ch = curl_init('https://api.telegram.org/bot' . TOKEN . '/' . $method);  
    curl_setopt($ch, CURLOPT_POST, 1);  
    curl_setopt($ch, CURLOPT_POSTFIELDS, $response);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, false);
    $res = curl_exec($ch);
    curl_close($ch); 
    return $res;
}
 
// Ответ на текстовые сообщения.
if (!empty($data['message']['text'])) {
    $text = $data['message']['text'];


$keyboard = [
    [ "/start" ],
    [ "/help" ],
    [ "Кнопка 3" ]
];

$reply_markup = json_encode([
    "keyboard"=>$keyboard,
    "resize_keyboard"=>true
]);


// Команда /start.
    if (mb_stripos($text, '/start') !== false) {
        sendTelegram(
            'sendMessage', 
            array(
                'chat_id' => $data['message']['chat']['id'],
                'text'=>'Добро пожаловать в бота! /help /photo',
                'reply_markup'=>$reply_markup
        
            )
        ); 
        exit(); 
    } 
 
    if (mb_stripos($text, '/help') !== false) {
        sendTelegram(
            'sendMessage', 
            array(
                'chat_id' => $data['message']['chat']['id'],
                'text' => 'Помощь!'
            )
        );
        exit(); 
    } 
 
    // Отправка фото.
    if (mb_stripos($text, '/photo') !== false) {
        sendTelegram(
            'sendPhoto', 
            array(
                'chat_id' => $data['message']['chat']['id'],
                'photo' => curl_file_create(__DIR__ . '/img/edem.jpg'),
                'caption' => "Подпись к изображению",
                'parse_mode' => 'HTML',
            )
        );      
        exit(); 
    }
 
}
php
  • 1 个回答
  • 34 Views
Martin Hope
user695031
Asked: 2025-03-06 19:29:32 +0000 UTC

如何在单击时删除动态创建的按钮?

  • 6

单击 FOR 循环创建的按钮之一后将其删除。需要像“这个”这样的东西。

这就是为什么被删除的不是被点击的按钮,而是最后创建的按钮:

def btnDel():
    btn.destroy()

j=0
for i in seat.values():
    j+=1
    btn=Button(frRoom,text='МЕСТО %s'% j,width=10,height=5,command=btnDel)
    btn.place(x=i[0],y=i[1])

理想情况下,会有类似的东西,但据我所知,Python 没有这个

command=lambda:this.destroy()

我也不明白如何捕捉按下特定按钮的事件

python
  • 1 个回答
  • 28 Views
上一页
下一页

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5