nefu 1004 2,3,5,7的倍数
来源:互联网 发布:布列根和妇女医院 知乎 编辑:程序博客网 时间:2024/05/06 09:57
2,3,5,7的倍数
Problem:1004
Time Limit:1000ms
Memory Limit:65536K
Description
给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如N = 10,只有1不是2 3 5 7的倍数。
Input
输入1个数N(1 <= N <= 10^18)。
Output
输出不是2 3 5 7的倍数的数共有多少。
Sample Input
10
Sample Output
1
#include<iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <map>#include <string>#include <queue>using namespace std;int main(){ long long n,t; while(cin>>n){ t=n/2+n/3+n/5+n/7-n/6-n/10-n/14-n/15-n/21-n/35+n/105+n/70+n/42+n/30-n/210; cout<<n-t<<endl; } return 0;}
0 0
- nefu 1004 2,3,5,7的倍数
- 1284 2 3 5 7的倍数
- 1284 2 3 5 7的倍数
- 2 3 5 7的倍数
- 1284 2 3 5 7的倍数
- 2 3 5 7的倍数
- 2 3 5 7的倍数
- 2 3 5 7的倍数
- 2 3 5 7的倍数
- 3的倍数和5的倍数
- 51-nod -1284 2 3 5 7的倍数
- 51NOD 1284 2 3 5 7的倍数
- 51nod 1284 2 3 5 7的倍数
- 51nod1284 2 3 5 7的倍数
- 51nod1284 2 3 5 7的倍数
- 51nod1284 2 3 5 7的倍数
- 51nod 1284 2 3 5 7的倍数
- 51nod 1284 2 3 5 7的倍数
- LeetCode 116(Java)
- SEO页面视觉美学:成为你自己的“梵高”
- Java开发中的23种设计模式详解
- 经典SQL语句大全(绝对的经典)
- ubuntu下播放h264,h265文件
- nefu 1004 2,3,5,7的倍数
- Android源码查看 Activity(1)
- ubuntu下播放h264,h265文件
- Touch事件分发机制
- HTML网页开发学习笔记(燕十八)-40 a标签伪类
- GCD API 记录 (三)
- adb相关
- FreeSwitch Event Socket Command(事件套接字命令行)
- uboot 详细注释讲解