当前位置:网站首页>ABC253 D FizzBuzz Sum Hard(容斥定理)
ABC253 D FizzBuzz Sum Hard(容斥定理)
2022-06-29 17:47:00 【eva_can(not)survive】
D - FizzBuzz Sum Hard
https://atcoder.jp/contests/abc253/tasks/abc253_d
void solve(){
scanf("%lld %lld %lld",&n,&a,&b);
ll tmp=(n+1)*n/2;
ll rec1=n/a,rec2=n/b;
ll tmp1=(a+a*rec1)*rec1/2;
ll tmp2=(b+b*rec2)*rec2/2;
ll g=__gcd(a,b);
ll lcm=a*b/g;
ll rec3=n/lcm;
ll tmp3=(lcm+lcm*rec3)*rec3/2;
printf("%lld",tmp-(tmp1+tmp2-tmp3));
}边栏推荐
- MATLAB 最远点采样(FPS)
- 基于gis三维可视化的智慧城市行业运用
- What is a SCM system? What are the advantages of a supply chain management system?
- R language uses user-defined functions to write deep learning linear activation functions and visualize linear activation functions
- ISO 32000-2 国际标准7.7
- Matlab farthest point sampling (FPS)
- 分割回文串[dp + dfs组合]
- R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、使用exp函数和coef函数获取模型所有变量的事件密度比(Incidence Density Ratio,IDR)并解读
- Epoll analysis
- 关于日期相加减问题
猜你喜欢

从一个被应用商店坑了的BUG说起

Inherit Chinese virtues, pay attention to the health of the middle-aged and the elderly, and Yurun milk powder has strong respect for the elderly

Walk with love, educate and run poor families, and promote public welfare undertakings

selenium 文件上传方法

YoloV6+TensorRT+ONNX:基于WIN10+TensorRT8+YoloV6+ONNX的部署

布隆过滤器:

PCB frame drawing - ad19

Visio annotation, annotation location

Top 30 open source software

育润多维发力慈善领域,勇抗企业公益大旗
随机推荐
Visio标注、批注位置
What is the MySQL query view command
R语言使用自定义函数编写深度学习线性激活函数、并可视化线性激活函数
R language uses user-defined functions to write deep learning leaky relu activation functions and visualize leaky relu activation functions
3h精通OpenCV(九)-最简单的人脸检测
mac安装php7.2
reflex
Sword finger offer 13 Robot range of motion (BFS)
从一个被应用商店坑了的BUG说起
R语言dplyr包filter函数通过组合逻辑(与逻辑)过滤dataframe数据中的数据、其中一个字段的内容等于指定向量中的其中一个,并且另外一个字段值大于某一阈值
SRM supplier collaborative management system function introduction
自定義HandlerInterceptor攔截器實現用戶鑒權
基于STM32F103ZET6库函数PWM输出实验
Cross border independent station language Unicode to Hebrew
Can MySQL views create indexes
Partial mock of static class of phpunit operation
基于STM32F103ZET6库函数独立看门狗(IWDG)实验
[网鼎杯 2020 青龙组]AreUSerialz
自定义HandlerInterceptor拦截器实现用户鉴权
What is the function of MySQL cursors