当前位置:网站首页>Abc253 D fizzbuzz sum hard (tolerance exclusion theorem)
Abc253 D fizzbuzz sum hard (tolerance exclusion theorem)
2022-06-29 17:56:00 【eva_ can(not)survive】
D - FizzBuzz Sum Hardhttps://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));
}
边栏推荐
- Professor of Cambridge University: eating breakfast often is harmful and dangerous. - you know what
- How to create and delete MySQL triggers
- Have you grasped the most frequently asked question in the interview about massive data processing?
- selenium 组合键操作
- 软件测试——基础理论知识你都不一定看得懂
- Can MySQL views create indexes
- [网鼎杯 2020 青龙组]AreUSerialz
- Mysql database literacy, do you really know what a database is
- Set double click to run the jar file
- Parental delegation mechanism
猜你喜欢
mysql. What is the concept of sock
Prevent form resubmission based on annotations and interceptors
How to create and delete MySQL triggers
QQ如何开通在线客服
Visio标注、批注位置
【WebDriver】使用AutoIt上传文件
最受欢迎的30款开源软件
Detailed introduction and Simulation of bitmap
Industry application of smart city based on GIS 3D visualization
Face recognition 4- research on Baidu commercial solutions
随机推荐
基于gis三维可视化的智慧城市行业运用
国外LEAD赚钱,做个网站真的很简单
Teach you how to install the latest version of mysql8.0 database on windows, nanny level teaching
mac安装php7.2
Uploading files using AutoIT
js两个一维数组合并并去除相同项(整理)
mysql. What is the concept of sock
小白月赛51 补题 E G F
Split palindrome string [dp + DFS combination]
Force deduction daily question 06.29 add two numbers
字典树(随学)
Does rapid software delivery really need to be at the cost of security?
Issue 42: is it necessary for MySQL to have multiple column partitions
How to solve MySQL 1045 error in Linux
给定一个数在序列中求最大异或值(01字典)
回文子串的最大长度(字符串哈希+二分)
Web Scraping with Beautiful Soup for Data Scientist
reflex
Li Kou today's question -535 Encryption and decryption of tinyurl
The R language uses the KAP function (kap.2.raters function) of epidisplay package to calculate the value of kappa statistics (total consistency, expected consistency), analyze the consistency of the