2018年中南大学机试题

题目链接在这里

 

A.数学题,(附上草稿,不要嫌弃字丑),事实上就是这么化成一个数学式子

代码如下:

#include <iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<fstream>
#include<queue>
#include<stack>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 1e3+5;
const int inf = 0x3f3f3f3f;
const int maxx = 1e3+50;
 
int main()
{
    int T;
    int tt = scanf("%d",&T);
    for(int ka = 1; ka<=T; ka++)
    {
       int x1,x2,y1,y2;
       int u1,u2,v1,v2;
       scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
       scanf("%d%d%d%d",&u1,&v1,&u2,&v2);
       int a,b,c,d;
       double ans = 0;
       a = x1-x2; b = u1-u2;  c = y1 - y2;  d = v1-v2;
       if(a*b+c*d > 0)
       {
           ans = sqrt((double)a*a + (double)c*c);
          // ans = ans + 5e-7;
       }
       else
       {
           double s1 = (double)a*b + (double)c*d;
           double s2 = (double)b*b + (double)d*d;
            double s3 = (double)a*a + (double)c*c;
     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值