HDU 5655 CA Loves Stick

Source: Internet
Author: User
Tags bitset cmath

Hdu 5655CA Loves Stick

  First sort four edges, if the smallest side is 0, then output no (start with no and yes written no and Yes,wa n times)

Then Judge A[2]+a[1]+a[0]>A[3]; meet can form a quadrilateral, notice here will explode long long, can be used to judge by subtraction,

a[3]-a[2]-a[1]<a[0];

Or with unsigned long long, it can be changed to determine the condition of a[3]-a[2]<a[1]+a[2];

Long Long range: -2^63-1 to 2^63-1

    unsigned long long: 0 to 2^64-1

    

#include <cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<ctime>#include<iostream>#include<algorithm>#include<string>#include<vector>#include<deque>#include<list>#include<Set>#include<map>#include<stack>#include<queue>#include<numeric>#include<iomanip>#include<bitset>#include<sstream>#include<fstream>using namespacestd;#defineRep (i,a,n) for (int i=a;i<n;i++)#definePer (i,a,n) for (int i=n-1;i>=a;i--)#defineIn (n) scanf ("%d",& (n))#defineIn2 (X1,X2) scanf ("%d%d",& (x1),& (x2))#defineINLL (n) scanf ("%i64d",& (n))#defineInll2 (X1,X2) scanf ("%i64d%i64d",& (x1),& (x2))#defineINLLD (n) scanf ("%lld",& (n))#defineInlld2 (X1,X2) scanf ("%lld%lld",& (x1),& (x2))#defineINF (n) scanf ("%f",& (n))#defineInf2 (X1,X2) scanf ("%f%f",& (x1),& (x2))#defineINLF (n) scanf ("%lf",& (n))#defineINLF2 (X1,X2) scanf ("%lf%lf",& (x1),& (x2))#defineInc (STR) scanf ("%c",& (str))#defineINS (str) scanf ("%s", (str))#defineOut (x) printf ("%d\n", (x))#defineOut2 (x1,x2) printf ("%d%d\n", (x1), (x2))#defineOutf (x) printf ("%f\n", (x))#defineOUTLF (x) printf ("%lf\n", (x))#defineOUTLF2 (x1,x2) printf ("%lf%lf\n", (x1), (x2));#defineOUTLL (x) printf ("%i64d\n", (x))#defineOUTLLD (x) printf ("%lld\n", (x))#defineOUTC (str) printf ("%c\n", (str))#definePB Push_back#defineMP Make_pair#defineFi first#defineSe Second#defineSZ (x) ((int) (x). Size ())#defineMem (x, y) memset (x,y,sizeof (×));typedef vector<int>Vec;typedefLong LongLl;typedef pair<int,int>P;Const intdx[4]={1,0,-1,0},dy[4]={0,1,0,-1};Const intinf=0x3f3f3f3f;Constll mod=1e9+7; ll Powmod (ll A,ll b) {ll res=1; a%=mod; for(; b;b>>=1){if(b&1) Res=res*a%mod;a=a*a%mod;}returnRes;}Const BOOLAc=true;Long Long inta[4];intMain () {intT; inch(t);  while(t--) {Rep (I,0,4) Cin>>A[i]; Sort (A,a+4); if(a[0]==0) printf ("no\n"); Else{        if(a[3]-a[2]-a[1]<a[0]) printf ("yes\n"); Elseprintf ("no\n"); }    }    return 0;}

Or

#include <cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<ctime>#include<iostream>#include<algorithm>#include<string>#include<vector>#include<deque>#include<list>#include<Set>#include<map>#include<stack>#include<queue>#include<numeric>#include<iomanip>#include<bitset>#include<sstream>#include<fstream>using namespacestd;#defineRep (i,a,n) for (int i=a;i<n;i++)#definePer (i,a,n) for (int i=n-1;i>=a;i--)#defineIn (n) scanf ("%d",& (n))#defineIn2 (X1,X2) scanf ("%d%d",& (x1),& (x2))#defineINLL (n) scanf ("%i64d",& (n))#defineInll2 (X1,X2) scanf ("%i64d%i64d",& (x1),& (x2))#defineINLLD (n) scanf ("%lld",& (n))#defineInlld2 (X1,X2) scanf ("%lld%lld",& (x1),& (x2))#defineINF (n) scanf ("%f",& (n))#defineInf2 (X1,X2) scanf ("%f%f",& (x1),& (x2))#defineINLF (n) scanf ("%lf",& (n))#defineINLF2 (X1,X2) scanf ("%lf%lf",& (x1),& (x2))#defineInc (STR) scanf ("%c",& (str))#defineINS (str) scanf ("%s", (str))#defineOut (x) printf ("%d\n", (x))#defineOut2 (x1,x2) printf ("%d%d\n", (x1), (x2))#defineOutf (x) printf ("%f\n", (x))#defineOUTLF (x) printf ("%lf\n", (x))#defineOUTLF2 (x1,x2) printf ("%lf%lf\n", (x1), (x2));#defineOUTLL (x) printf ("%i64d\n", (x))#defineOUTLLD (x) printf ("%lld\n", (x))#defineOUTC (str) printf ("%c\n", (str))#definePB Push_back#defineMP Make_pair#defineFi first#defineSe Second#defineSZ (x) ((int) (x). Size ())#defineMem (x, y) memset (x,y,sizeof (×));typedef vector<int>Vec;typedefLong LongLl;typedef pair<int,int>P;Const intdx[4]={1,0,-1,0},dy[4]={0,1,0,-1};Const intinf=0x3f3f3f3f;Constll mod=1e9+7; ll Powmod (ll A,ll b) {ll res=1; a%=mod; for(; b;b>>=1){if(b&1) Res=res*a%mod;a=a*a%mod;}returnRes;}Const BOOLAc=true; unsignedLong Longa[4];intMain () {intT; inch(t);  while(t--) {Rep (I,0,4) Cin>>A[i]; Sort (A,a+4); if(a[0]==0) printf ("no\n"); Else{        if(a[3]-a[2]<a[1]+a[0]) printf ("yes\n"); Elseprintf ("no\n"); }    }    return 0;}

HDU 5655 CA Loves Stick

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.