(组合数学)不定方程的解+猜测——cf997B
2024-09-06 11:29:18
首先要求出三种等价情况
5×1+1×50=1×5+5×105×1+1×50=1×5+5×10
9×5=5×1+4×10
8×5+1×50=9×10
那么可以求出三种关于x5,x10的不可行条件
x5 ≥ 1 且 x10 ≥ 5
x5 ≥ 9
x10 ≥ 9
那么只要依次枚举这x5,x10的可能的取值,用不定方程的解数量累计即可
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
long long ans = ;
for (int i = ; i <= && i <= n; i++)
{
for (int j = ; j <= (i == ? : ) && i + j <= n; j++)
{
ans += n + - i - j;
}
}
cout << ans << endl;
}
return ;
}
最新文章
- Spring源码分析——BeanFactory体系之抽象类、类分析(二)
- ecplise常用快捷键
- JS实现验证码倒计时效果
- Pyunit测试框架
- Maven+Spring+Spring MVC+MyBatis+MySQL,搭建SSM框架环境
- ProcExp和TaskMgr的列对比
- Spring IoC小结
- ! cocos2d sprintf的问题
- External Table
- shell中使用echo命令改变输出显示样式
- Jquery 进度条集锦
- 【LuaJIT版】从零开始在 macOS 上配置 Lua 开发环境
- performance数据
- string函数详解(配案例)
- Python3 Selenium多窗口切换
- Palindromic characteristics CodeForces - 835D (区间DP,预处理回文串问题)
- [LeetCode&;Python] Problem 744. Find Smallest Letter Greater Than Target
- Unreal Engine 4 C++ UCLASS构造函数易出错分析
- linux中crontab的使用方法
- meterpreter 如何留后门,使攻击持久化