codefoces #404 C. Anton and Fairy Tale
来源:互联网 发布:mac重装失败 编辑:程序博客网 时间:2024/06/07 18:58
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;}
0 0
- codefoces #404 C. Anton and Fairy Tale
- C. Anton and Fairy Tale
- C. Anton and Fairy Tale
- C. Anton and Fairy Tale
- C. Anton and Fairy Tale
- Anton and Fairy Tale
- Anton and Fairy Tale
- Codeforces Round #404 C. Anton and Fairy Tale
- Codeforces Round #404 (Div. 2) C. Anton and Fairy Tale
- codeforces round#404(div.2) C. Anton and Fairy Tale
- Codeforces #404 (Div. 2) C. Anton and Fairy Tale (二分
- Codeforces Round #404 (Div. 2) C. Anton and Fairy Tale
- 【codeforces 785C】Anton and Fairy Tale
- Codeforces 785C-Anton and Fairy Tale
- CodeForces #785 c Anton and Fairy Tale
- (code forces) C. Anton and Fairy Tale
- Codeforces 785C Anton and Fairy Tale
- codeforces Anton and Fairy Tale
- 作业GFOJ471(sg函数)
- 模仿Wireshark网络抓包工具实现---c++
- 我的第一篇博客
- 399. Evaluate Division
- Java多线程系列--“基础篇”07之 线程休眠
- codefoces #404 C. Anton and Fairy Tale
- Unity3D Shader之路 VS2015下Graphics Debugger调试Shader
- 不使用中间变量实现两个整数的交换
- 浮点数转整数注意的地方
- 一个div在页面居中的css写法
- jQuery中size()和length的区别
- sql中的group by 和 having 用法解析
- Lua 笔记(二)
- TensorFlow入门-CIFAR10&CNN