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. c++学习笔记——智能指针

    智能指针是为了便于管理动态内存,能够自动管理释放所指向的对象. 智能指针共有三种:1.shared_ptr允许多个指针指向同一个对象:2.unique_ptr独占所指向的对象:3.weak_ptr是一 ...

  2. vc++ basic chapt1

    ______API 和SDK _像c程序可以调用各种函数库一样, windows操作系统提供应用程序编程的接口application programming interface简称API函数. 所以主 ...

  3. 想要隐藏navigationBar,同时又想支持右滑返回功能

    如果直接设置 self.navigationBarHidden = YES; 那同时也会屏蔽右滑返回功能. 解决办法1: self.navigationBarHidden = NO; self.nav ...

  4. jQuery设置和获取以及修改class name值操作

    在Web程序开发中.很多时候会用需要修改Html标签的class名称.来达到修改标签样式的效果.那么在代码中一般是怎么操作的呢.本文将为你详细讲解一下class的使用.在jQuery中可以使用attr ...

  5. java1.7集合源码阅读:LinkedList

    先看看类定义: public class LinkedList<E> extends AbstractSequentialList<E> implements List< ...

  6. docker--wekan安装

    最近因为搭建开源看板网站的需要,玩了下docker 一开始在redhat上安装docker wget http://mirrors.163.com/.help/CentOS7-Base-163.rep ...

  7. Android 环境通过国内映像快速搭建

    Android 环境通过国内映像快速搭建 转眼大半年没有写android程序了,回顾从环境搭建开始. 因为google受国内限制,因此下载android的SDK相当慢,因此寻找国内的镜像进行搭建. 首 ...

  8. python学习之——小闹钟(持续完善ing)

    "啊,坏了,我忘了那啥啥了~~~" 为了不坏了,动手做一个小闹钟吧,一点点完善的过程一定美好极了,必像等待培育许久的花儿绽放一样,不多说,加油,期待↖(^ω^)↗ #! /usr/ ...

  9. sublime使用以及快捷键

    1.工程文件中的内容的查找替换 例: 想要把工程文件中的“山东”改为“云南”. 1)首先选中工程文件夹 2)右击出现下拉菜单,选择 find&replace 选项 3)出现在编辑框内输入要查找 ...

  10. HttpServletrequest 与HttpServletResponse总结

    如果说DOM是javascript与HTML的桥梁,那么servlet就是前端与后端的桥梁,HttpServletRequest和HttpServletResponse就是之间的信使,好了,废话不多说 ...