J. Divisibility
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer of this game gets a small bonus.

A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.

Input

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the prediction on the number of people who will buy the game.

Output

Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10.

Examples
input
3000
output
1

题意:给你一个长整形数n,让你计算出1到n中有多少个数可以被2到10之间的所有数整除,包括2和10;
题解:先打表找规律,发现任意两个相邻的满足条件的两个数之间相差 2520,所以拿n除以2520就是结果
#include<stdio.h>      //j
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#define INF 0x3f3f3f
#define MAX 100100
#define LL long long
using namespace std;
int main()
{
LL n,m,j,i;
LL sum;
while(scanf("%lld",&n)!=EOF)
{
sum=n/2520;
printf("%lld\n",sum);
// sum=0; //打表找规律
// for(i=1;i<=n;i++)
// {
// int flag=1;
// for(j=6;j<=10;j++)
// {
// if(i%j!=0)
// {
// flag=0;
// break;
// }
// }
// if(flag)
// {
// printf("%d ",i);
// sum++;
// }
// }
// printf("\n%d\n",sum);
}
return 0;
}

  

codeforces 630J Divisibility的更多相关文章

  1. Codeforces 550C —— Divisibility by Eight——————【枚举 || dp】

     Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  2. [math] Codeforces 597A Divisibility

    题目:http://codeforces.com/problemset/problem/597/A Divisibility time limit per test 1 second memory l ...

  3. Codeforces 922F Divisibility 构造

    Divisibility 我们考虑删数字 首先我们可以发现有一类数很特殊就是大于 n / 2的素数, 因为这些素数的贡献只有1, 并且在n大的时候, 这些素数的个数不是很少, 我们可以最后用这些数去调 ...

  4. Codeforces 922F Divisibility (构造 + 数论)

    题目链接  Divisibility 题意 给定$n$和$k$,构造一个集合$\left\{1, 2, 3, ..., n \right\}$的子集,使得在这个集合中恰好有$k$对正整数$(x, y) ...

  5. CodeForces 597A Divisibility

    水题. #include<iostream> #include<cstring> #include<cmath> #include<queue> #in ...

  6. Codeforces 988E. Divisibility by 25

    解题思路: 只有尾数为25,50,75,00的数才可能是25的倍数. 对字符串做4次处理,以25为例. a. 将字符串中的最后一个5移到最后一位.计算交换次数.(如果没有找到5,则不可能凑出25,考虑 ...

  7. Codeforces Round #306 (Div. 2) C. Divisibility by Eight 暴力

    C. Divisibility by Eight Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...

  8. Codeforces Testing Round #12 A. Divisibility 水题

    A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...

  9. Codeforces Round #486 (Div. 3) E. Divisibility by 25

    Codeforces Round #486 (Div. 3) E. Divisibility by 25 题目连接: http://codeforces.com/group/T0ITBvoeEx/co ...

随机推荐

  1. 转:Cache相关

    声明:本文截取自http://blog.163.com/ac_victory/blog/static/1033187262010325113928577/ (1)“Cache”是什么 Cache(即高 ...

  2. Python3 学习第四弹:编码问题(转载)

    关于python的编码问题一直以来不得解,终于在今天从这篇博文中明白了. 原文地址: http://nedbatchelder.com/text/unipain.html 译文地址:http://py ...

  3. 函数buf_page_create

    /********************************************************************//** Initializes a page to the ...

  4. Spring MVC 的请求参数获取的几种方法

    通过@PathVariabl注解获取路径中传递参数 @RequestMapping(value = "/{id}/{str}") public ModelAndView hello ...

  5. UVa 11542 (高斯消元 异或方程组) Square

    书上分析的太清楚,我都懒得写题解了.=_=|| #include <cstdio> #include <cstring> #include <cmath> #inc ...

  6. HDU 2087 (KMP不可重叠的匹配) 花布条

    题意: 用两个字符串分别表示布条和图案,问能从该布条上剪出多少这样的图案. 分析: 毫无疑问这也是用KMP匹配,关键是一次匹配完成后,模式串应该向后滑动多少. 和上一题 HDU 1686 不同,两个图 ...

  7. Jqgrid入门-Jqgrid设置二级表头(六)

    上一章已经说明了Jqgrid结合Struts2+json展示数据,这一章主要探讨Jqgrid如何设置二级表头,类似这样的效果.如:           要实现这个功能,其实也不难.通过Jqgrid的s ...

  8. OOD、OOP、AOP区别

    OOD:面向对象设计(Object-Oriented Design,OOD)方法是OO方法中一个中间过渡环节.其主要作用是对OOA分析的结果作进一步的规范化整理,以便能够被OOP直接接受. OOP:面 ...

  9. Sourcetree add Submodule

    LMXMN041:ximalaya will.wei$ git submodule add https://github.com/willbin/WeLib02.git Submodule Cloni ...

  10. 一天一个Java基础——泛型

    这学期的新课——设计模式,由我仰慕已久的老师传授,可惜思维过快,第一节就被老师挑中上去敲代码,自此在心里烙下了阴影,都是Java基础欠下的债 这学期的新课——算法设计与分析,虽老师不爱与同学互动式的讲 ...