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);
}
目录
相关文章
|
10月前
|
Java
HDU-2199-Can you solve this equation?
HDU-2199-Can you solve this equation?
53 0
|
10月前
|
Java
HDU-2199-Can you solve this equation
HDU-2199-Can you solve this equation
46 0
|
图形学
hdu1086 You can Solve a Geometry Problem too(判断线段相交)
hdu1086 You can Solve a Geometry Problem too(判断线段相交)
91 0
UVa10776 - Determine The Combination(有重复元素的组合问题)
UVa10776 - Determine The Combination(有重复元素的组合问题)
57 0
UVa11565 - Simple Equations
UVa11565 - Simple Equations
60 0
LeetCode 221. Maximal Square
在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积。
73 0
LeetCode 221. Maximal Square
|
Go
HDOJ(HDU) 1977 Consecutive sum II(推导、、)
HDOJ(HDU) 1977 Consecutive sum II(推导、、)
118 0