You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
453 B
C++
20 lines
453 B
C++
#include <algorithm>
|
|
#include <cmath>
|
|
#include <cstdio>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
long long T, n;
|
|
scanf("%lld", &T);
|
|
for (long long t = 1; t <= T; t++)
|
|
{
|
|
scanf("%lld", &n);
|
|
for (long long i = sqrt(n * 2) + 10; i; i--)
|
|
if (i * (i + 1) / 2 <= n)
|
|
{
|
|
printf("Case #%lld: %lld\n", t, i * (i + 1) / 2);
|
|
break;
|
|
}
|
|
}
|
|
return 0;
|
|
} |