Smiling & Weeping

                    ----总有一个人,

                      一直住在心底,

                      却消失在生活里。

Given a positive integer n, find the maximum size of an interval [l,r] of positive integers such that, for every in the interval (i.e., l≤i≤r), n is a multiple of i.

Given two integers l≤r, the size of the interval [l,r] is r−l+1 (i.e., it coincides with the number of integers belonging to the interval).

题目链接:Problem - B - Codeforces

题目大意:给出一个整数n,求一个区间(要求区间连续,且每个整数都能整除n)

思路:当时这个题目感觉很奇怪,不难但是不好想,例如,若n不能被3整除,那么一定不能被三的倍数整除(也就是说每取出三个连续的数,必有一个不能不符合题意),那么我们就好想通了,直接求从1-n,最多能被多少个连续的数字整除。

Input:

10
1
40
990990
4204474560
169958913706572972
365988220345828080
387701719537826430
620196883578129853
864802341280805662
1000000000000000000

Output:

1
2
3
6
4
22
3
1
2
2

现在是代码时间 ̄へ ̄:Show me Your Code

 1 #include<bits/stdc++.h>
2 using namespace std;
3 int t;
4 typedef long long ll;
5 int main()
6 {
7 scanf("%d",&t);
8 while(t--)
9 {
10 int i = 1;
11 ll num , cnt = 0;
12 scanf("%lld",&num);
13 while(num%i == 0) i++ , cnt++;
14 printf("%lld\n",cnt);
15 }
16 return 0;
17 }

文章到此结束,我们下次再见ヾ( ̄▽ ̄)Bye~Bye~

Longest Divisors Interval的更多相关文章

  1. 【leetcode】1124. Longest Well-Performing Interval

    题目如下: We are given hours, a list of the number of hours worked per day for a given employee. A day i ...

  2. Longest subarray of target sum

    2018-07-08 13:24:31 一.525. Contiguous Array 问题描述: 问题求解: 我们都知道对于subarray的问题,暴力求解的时间复杂度为O(n ^ 2),问题规模已 ...

  3. Milking Cows

    Milking Cows Three farmers rise at 5 am each morning and head for the barn to milk three cows. The f ...

  4. 【USACO】Milking Cows

    Three farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer b ...

  5. Contiguous Array with Equal Number of 0 & 1

    2018-07-08 13:24:31 问题描述: 问题求解: 问题规模已经给出是50000量级,显然只能是O(n),至多O(nlogn)的复杂度.本题使用DP和滑动数组都比较棘手,这里给出的方案是p ...

  6. Primes on Interval(二分 + 素数打表)

    Primes on Interval Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u ...

  7. [leetcode] 5.Longest Palindromic Substring-2

    想了很多方法 搞轴对称,算对称轴,偶数都高出了一堆0.5在那加加减减,最后发现在移轴之前可能就返回了. class Solution: def longestPalindrome(self, s: s ...

  8. [leetcode] 5.Longest Palindromic Substring-1

    开始觉得挺简单的 写完发现这个时间超限了: class Solution: def longestPalindrome(self, s: str) -> str: # longest palin ...

  9. 5. Longest Palindromic Substring - Unsolved

    https://leetcode.com/problems/longest-palindromic-substring/#/description Given a string s, find the ...

  10. LeetCode解题报告—— 2 Keys Keyboard & Longest Palindromic Substring & ZigZag Conversion

    1. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You ...

随机推荐

  1. day08-SpringCloud Gateway-服务网关

    SpringCloud Gateway-服务网关 1.Gateway介绍 1.1引出问题 没有使用网关服务时: 使用网关服务后: 1.2Gateway网络拓扑图 1.3Gateway是什么 官网:Sp ...

  2. const 使用

    宏定义与const的区别?(概念题是最容易丢分)1. 发生时机不一样: 宏定义发生在预处理时,const关键字发生编译时2. 宏定义仅仅只做了字符串的替换,没有类型检查; const关键字有类型检查, ...

  3. 记一次加锁导致ECS服务器CPU飙高的处理

    导航 火线告警,CPU飚了 版本回退,迅速救火 猜测:分布式锁是罪魁祸首 代码重构,星夜上线 防患未然,功能可开关 高度戒备,应对早高峰 实时调整方案,稳了 结语 参考 本文首发于智客工坊-<记 ...

  4. 记一次 .NET 某药材管理系统 卡死分析

    一:背景 1. 讲故事 前段时间有位朋友找到我,说他们在查询报表的时候发现程序的稳定性会受到影响,但服务器的内存,CPU都是正常的,让我帮忙看下怎么回事,问了下程序的稳定性指的是什么?指的是卡死,那既 ...

  5. java中基本数据类型和包装数据类型

    基本数据类型和包装数据类型在 Java 中有着重要的区别和联系,对于 Java 程序员来说,熟悉这两种数据类型的特点和使用方法是非常必要的. 基本数据类型 Java 中的基本数据类型一共有 8 种,分 ...

  6. 鸟类识别系统Python+Django+TensorFlow+卷积神经网络算法【完整代码】

    一.介绍 鸟类识别系统,使用Python作为主要开发语言,基于深度学习TensorFlow框架,搭建卷积神经网络算法.并通过对数据集进行训练,最后得到一个识别精度较高的模型.并基于Django框架,开 ...

  7. 记一次.net加密神器 Eazfuscator.NET 2023.2 最新版 使用尝试

    很多人看到这个Eazfuscator.NET还不知是什么东东... 首先介绍下 什么是 Eazfuscator.NET? Eazfuscator.NET 是用于.NET平台的工业级混淆器. Eazfu ...

  8. asp.net程序通过Microsoft Azure令牌授予流获取UserInfo终结点实现单点登录--隐式授予流(OIDC协议)

    1. Microsoft Azure令牌授予流 令牌授予流种类如下: 本章节采用: 隐式授予流: 2. 隐式授予流的实现 流程:重定向到authorize--->拿到access_token-- ...

  9. P3133 [USACO16JAN] Radio Contact G 无线电通话

    P3133 [USACO16JAN] Radio Contact G 无线电通话 目录 P3133 [USACO16JAN] Radio Contact G 无线电通话 [USACO16JAN] Ra ...

  10. playwright(十三) - PyTest基本使用

      我们都知道,在做单元测试框架中有UnitTest和Pytest,前者是Python中自带无需安装,Pytest需要安装,今天我们来讲的就是Pytest,当然如果是做自动化,建议两个都要掌握一下,可 ...