https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1284

基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题
 收藏
 关注
给出一个数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的倍数的数共有多少。
Input示例
10
Output示例
1

容斥原理
 #include <cstdio>

 #define LL long long

 using namespace std;

 LL n,tot;

 int main()
{
scanf("%lld",&n);
tot=(LL)n/+n/+n/+n/;
tot-=(LL)(n/+n/+n/+n/+n/+n/);
tot+=(LL)n/+n/+n/+n/;
tot-=(LL)(n/);
printf("%lld",n-tot);
return ;
}
 

最新文章

  1. CSS margin详解
  2. Spring Boot整合Activiti,查看流程图出现中文乱码问题
  3. cassandra 环境搭建
  4. 【USACO】beads
  5. LINQ之路 4:LINQ方法语法
  6. The Network Adapter could not establish the connection问题研究
  7. C盘清理大作战
  8. Exam 70-462 Administering Microsoft SQL Server 2012 Databases 复习帖
  9. [转] Transitions: Going from Shots to the Insulin Pump
  10. java泛型编程
  11. CDT+Eclipse代码自动提示
  12. javascript事件小结(事件处理程序方式)--javascript高级程序设计笔记
  13. HTML系列(八):表格
  14. ASP.NET MVC 5 学习教程:生成的代码详解
  15. Darwin Streaming Server 安装流程
  16. 软件性能测试技术树(二)----Linux服务器性能
  17. 系统重装助手教你如何在Microsoft Edge中恢复“关闭所有选项卡”警告
  18. python3 网页下拉框和悬浮框操作基础汇总
  19. JAVA记录-消息队列介绍
  20. android-------Android Studio使用MAT分析工具遇到的错误

热门文章

  1. Android学习笔记(23):列表项的容器—AdapterView的子类们
  2. selection-内容选中跟光标移动
  3. .Net数据操作案例
  4. 最短路 spfa, dijkstra, Floyd
  5. Entity Framework的原理及使用方式
  6. java种instanceof方法和getclass方法的区别
  7. vue2.0 transition用法
  8. 【hihocoder 1122】二分图二•二分图最大匹配之匈牙利算法
  9. ActiveMQ学习总结(3)——spring整合ActiveMQ
  10. 下载编译 Android wear 源代码,尝试制作可穿戴设备功能