the reason of failiure:1、sqrt与sqrtl是不一样的,当精度较大的时候,应该使用sqrtl
2、函数ceil是求不大于a的第一个整数
用求根公式进行计算
#include <iostream>
#include <stdio.h>
#include<cmath>
using namespace std;
long long g1,g2,g3;
int main(){
//freopen("in.txt","r",stdin);
int k,f1,f2,f3,n,f4,t1,t2,t3,t4,r,c;
cin >> g1 >> g2;
if(g2>g1){
cout << g1 <<endl;
return 0;
}
g1-=g2;
g3=ceil((-1+sqrtl(g1*8+1))/2);
cout << g3+g2 << endl;
return 0;
}