HDU 6343.Problem L. Graph Theory Homework-数学 (2018 Multi-University Training Contest 4 1012)
6343.Problem L. Graph Theory Homework
官方题解:
一篇写的很好的博客:
HDU 6343 - Problem L. Graph Theory Homework - [(伪装成图论题的)简单数学题]
代码:
1 //1012-6343-数学 2 #include<iostream> 3 #include<cstdio> 4 #include<cstring> 5 #include<algorithm> 6 #include<bitset> 7 #include<cassert> 8 #include<cctype> 9 #include<cmath> 10 #include<cstdlib> 11 #include<ctime> 12 #include<deque> 13 #include<iomanip> 14 #include<list> 15 #include<map> 16 #include<queue> 17 #include<set> 18 #include<stack> 19 #include<vector> 20 using namespace std; 21 typedef long long ll; 22 23 const double PI=acos(-1.0); 24 const double eps=1e-6; 25 const ll mod=1e9+7; 26 const int inf=0x3f3f3f3f; 27 const int maxn=1e5+10; 28 #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); 29 30 int a[maxn]; 31 32 int main() 33 { 34 int t; 35 cin>>t; 36 while(t--){ 37 int n; 38 cin>>n; 39 for(int i=1;i<=n;i++) 40 cin>>a[i]; 41 int ans=floor(sqrt(abs(a[1]-a[n]))); 42 cout<<ans<<endl; 43 } 44 }
滚了。。。