题目链接
https://codeforces.com/contest/1455/problem/B
题解
分类:
思维(cf的这个思维题,真的,阴间啊,呜呜呜)
代码:
#include <iostream>
using namespace std;
int main()
{
int t, n, i, x,a[2000] = {0},ans;
for (i = 1; i <= 1500; i++)
a[i] = a[i - 1] + i;
cin >> t;
while (t--)
{
cin >> x;
for (i = 1; i <= 1500; i++){
if (a[i] >= x){
if (a[i] == x)
cout << i << "\n";
else if (a[i] - 1 == x)
cout << i + 1 << "\n";
else
cout << i << "\n";
break;
}
}
}
return 0;
}