ICode9

精准搜索请尝试: 精确搜索
  • hdu Rightmost Digit2022-05-03 19:31:06

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1061 水题快速幂,求余进行最后一个取尾操作就可以,坑点不大, 直接上代码: Talk is cheap. Show me the code. #include<bits/stdc++.h> using namespace std; long long t; long long fastpow(long long a,long long b) { lon

  • Raspberry Pi 4B 循迹模块2021-09-24 21:33:35

    组件: Raspberry Pi 4B 8G 环境: Python:3.7.3 四路巡线模块连接的树莓派引脚是11, 7, 13, 15。 #-*- coding:UTF-8 -*- # 导入GPIO和time库 import RPi.GPIO as GPIO import time # 设置GPIO的编号模式 Tracking_Leftmost = 13 # 左边第一个传感器 Tracking_Left = 15 #

  • leetcode hot 100-55. 跳跃游戏2021-05-28 14:53:05

    55. 跳跃游戏 给定一个非负整数数组,你最初位于数组的第一个位置。 数组中的每个元素代表你在该位置可以跳跃的最大长度。 判断你是否能够到达最后一个位置。 示例 1: 输入: [2,3,1,1,4] 输出: true 解释: 我们可以先跳 1 步,从位置 0 到达 位置 1, 然后再从位置 1 跳 3 步到达最

  • LeetCode 45 跳跃游戏II2021-02-28 09:31:10

    用迭代没做出来,还是继续用贪心法。 class Solution { public: int jump(vector<int>& nums) { int count=0; int n=nums.size(); if(n==0||n==1) return 0; int rightmost=0; int end=0; for(int i=0;i<n-1;++i){

  • 位运算的技巧(有拓展的技巧)2020-01-29 22:57:25

    网络上有一篇位运算的文章,感觉有点新意,因此特意整理一下,转载发表。最基本的运算如下:这个我想学过计算机基础都知道,这里好像是使用C语言的。& - bitwise and| - bitwise or^ - bitwise xor~ - bitwise not<< - bitwise shift left>> - bitwise shift right1、检查整

  • codeforces_D. Treasure Hunting_[DP+Binary Search]2019-08-13 18:58:25

    http://codeforces.com/contest/1201/problem/D 题意:n行m列的矩阵中,有k个targets,从[1, 1]出发,每次只能向上下左右四个方向移动一步,且只有在q个safecolumns上进行向上移动,最少需要多少次移动才能获得所有的targets。(2≤n,m,k,q≤2*10^5,q≤m)。     思路: Make two arrays: left

  • A - Rightmost Digit2019-07-17 23:04:09

      思路: 运用快速幂。   代码: #include <iostream>#include <stdio.h>using namespace std;typedef long long LL;void quick_pow(int x){ int ans = 1, y = x; x = x % 10; while (y) { if (y & 1) ans = (ans * x) % 10; y &g

  • 【快速幂】【水】Rightmost Digit2019-03-23 14:51:00

    凡凡说:“我的数学,那是天下无敌,你们一个能打的都没有!” 凉凉听了,很不服气:“那我要考考你,N个N相乘的最后一位数字是多少? 输入 输入包含多组测试数据。输入的第一行是单个整数 T,表示测试数据的组数。接下来是 T 组测试数据。 每组测试数据,包含单个正整数 N (1 <= N <= 1,000,000,0

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

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

ICode9版权所有