UVa11296 - Counting Solutions to an Integral Equation(枚举技巧)

简介: UVa11296 - Counting Solutions to an Integral Equation(枚举技巧)
#include <cstdio>usingnamespacestd;
intn;
boolinput();
voidsolve();
intmain()
{
#ifndef ONLINE_JUDGEfreopen("d:\\OJ\\uva_in.txt", "r", stdin);
#endifwhile (input()) {
solve();
    }
return0;
}
boolinput()
{
returnscanf("%d", &n) ==1;
}
voidsolve()
{
n=n/2+1;
printf("%lld\n", (longlong)n* (n+1) /2);
}
目录
相关文章
|
7月前
|
Java
hdu-1016-Prime Ring Problem
hdu-1016-Prime Ring Problem
31 0
|
图形学
hdu1086 You can Solve a Geometry Problem too(判断线段相交)
hdu1086 You can Solve a Geometry Problem too(判断线段相交)
75 0
|
开发框架 .NET
poj 3468 A Simple Problem with Integers线段树区间修改
题目意思很简单,有N个数,Q个操作, Q l r 表示查询从l到r 的和,C l r v 表示将从l到r 的值加上v,明显的线段树,不知道线段树的人肯定暴力,肯定超时,哈哈!!
34 0
UVa11565 - Simple Equations
UVa11565 - Simple Equations
53 0
UVa10776 - Determine The Combination(有重复元素的组合问题)
UVa10776 - Determine The Combination(有重复元素的组合问题)
46 0
|
索引
LeetCode 413. Arithmetic Slices
如果一个数列至少有三个元素,并且任意两个相邻元素之差相同,则称该数列为等差数列。
105 0
LeetCode 413. Arithmetic Slices