http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27938#problem/E

题目大意:Given, n, count the number of solutions to the equation x+2y+2z=n, where x,y,z,n are non negative integers.
解题思路:只对一个枚举由此推算出另外两个的种类,千万不要都枚举!!!
#include<iostream>
#include<fstream>
#include<string>
#include<string.h>
using namespace std;
int main(){
for(long long int n;cin>>n;){
long long int y,sum=;
for(y=;y<=n/;y++){
sum+=(n-*y)/+;
}
cout<<sum<<'\n';
}
}

[ACM_数学] Counting Solutions to an Integral Equation (x+2y+2z=n 组合种类)的更多相关文章

  1. [ACM_模拟][ACM_数学] LA 2995 Image Is Everything [由6个视图计算立方体最大体积]

    Description   Your new company is building a robot that can hold small lightweight objects. The robo ...

  2. [ACM_数学] LA 3708 Graveyard [墓地雕塑 圈上新加点 找规律]

    Description   Programming contests became so popular in the year 2397 that the governor of New Earck ...

  3. [ACM_数学] Taxi Fare [新旧出租车费差 水 分段函数]

    Description Last September, Hangzhou raised the taxi fares. The original flag-down fare in Hangzhou ...

  4. [ACM_数学] Fibonacci Nim(另类取石子,2-4组合游戏)

    游戏规则: 有一堆个数为n的石子,游戏双方轮流取石子,满足: 1)先手不能在第一次把所有的石子取完: 2)之后每次可以取的石子数介于1到对手刚取的石子数的2倍之间(包含1和对手刚取的石子数的2倍). ...

  5. [ACM_数学] 大菲波数 (hdu oj 1715 ,java 大数)

    大菲波数 Problem Description Fibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3.计算第n项Fibonacci数值.   ...

  6. [GodLove]Wine93 Tarining Round #10

    比赛链接: http://www.bnuoj.com/v3/contest_show.php?cid=4159 题目来源: lrj训练指南---几何算法 Flag ID Title   A Board ...

  7. (light oj 1306) Solutions to an Equation 扩展欧几里得算法

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1306 You have to find the number of solutions ...

  8. [lightoj P1306] Solutions to an Equation

    [lightoj P1306] Solutions to an Equation You have to find the number of solutions of the following e ...

  9. Codeforces Little Dima and Equation 数学题解

    B. Little Dima and Equation time limit per test 1 second memory limit per test 256 megabytes input s ...

随机推荐

  1. 关于UID和GID的创建、修改、删除;简要举例

    用户.组和权限 安全3A资源分派 (authentication)认证 (authorization)授权 (accounting)审计 user( 用户) Linux用户:Username/UID ...

  2. Linux_05------Linux之vim编辑器

    行 * -/xxx 向后搜索 * -?xxx 向前搜索 * 命令模式下: * -h: 光标左移 * -j: 光标下移 * -k: 光标上移 * -l: 光标右移 * -ctrl+f: 向下翻页(fro ...

  3. json 判断字段

    1方式一 !("key" in obj) 方式二 obj.hasOwnProperty("key")  //obj为json对象. 2获取不确定键的值 for( ...

  4. rhel7网络管理

    实验-禁用网卡命名规则: 在GRUB_CMDLINE_Linux=“rd.lvm.lv=rhel/root  vconsole.keymap=us vconsole.font=latarcyheb-s ...

  5. hdu 3999 The order of a Tree (二叉搜索树)

    /****************************************************************** 题目: The order of a Tree(hdu 3999 ...

  6. 彻底卸载sublime txt

    最近彻底重装系统之后,安装sublime txt3, 自己设置了一些,总是觉得不是很对劲,想重新安装. 结果每次安装之后,总是有一些配置文件和卸载之前的是一样的,重复几次总是如此,于是网上搜资料,怎么 ...

  7. GDB的Breakpoint, Watchpoint和Catchpoint

    Breakpoint : 设置断点比较直接,在某处停止 Watchpoint : 观察点,即某个变量/表达式发生变化时,停止.可扩展为变量被读/被写/被读or写时都停止 Catchpoint : 在发 ...

  8. iptables文件

    # Firewall configuration written by system-config-firewall# Manual customization of this file is not ...

  9. 1016. Phone Bills (25)

    分析: 模拟题,提交无数次WA,注意几点: 1.如果某人没有有效通话记录,则不输出该人的信息,在此WA15次,题目看了N遍也没出现啊. 2.通话时间钱的计算:假设我们计算time1到time2的账单: ...

  10. (Python)序列

    本节将学习一些循环序列的方法已经序列的大小比较规则 1.循环序列的方法 如果我们想同时循环打印一个列表的index和value,我们可以用enumerate(list) 函数 >>> ...