AtCoder Beginner Contest 239 A~E

A

题面
Problem Statement
Assuming that the horizon seen from a place x meters above the ground is
sqrt(x(12800000+x))

meters away, find how many meters away the horizon seen from a place H meters above the ground is.
大意
假设从一个地方看到的地平线X离地米是 sqrt(x ( 1 2 8 0 0 0 0 0+x )) 米外,找出从一个地方看到的地平线有多少米H米以上的地面是。

简单的A,具体看代码理解吧
代码

#include<bits/stdc++.h>
using namespace std;

#include<atcoder/all>
using namespace atcoder;

using ll=long long;

int main(){
   
    ll H;
    cin>>H;
    long double ans=sqrt(H*(12800000+H));
    cout<<fixed<<setprecision(10)<<ans<<endl;
}

B

题面
Given an integer X between −1018 and 1018(inclusive), print ⌊ 10X ⌋.
大意
给定一个整数X之间− 1018和1018(含),输出⌊ 1 0X ⌋.

这个更简单,直接上代码
代码

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll x;
    cin>>x;
    ll ans=x/10;
    if(x<0&&x%10!=0)
        ans-=1;
        cout<<ans;
    return 0;
}

C

题面
On an xy-coordinate plane, is there a lattice point whose distances from two lattice points (x1 ,y1 ) and (x2 ,y2) are both sqrt(5)?
大意
在xy坐标平面上,是否存在一个格点,它到两个格点(x1,y1)和(x2,y2)的距离都是根号5?

一个点xy _- 坐标平面,其X和Y坐标都是整数,称为格点。
我是把每一个坐标都遍历一遍的,模拟出的
代码

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值