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++)