Untitled
unknown
c_cpp
4 years ago
680 B
8
Indexable
#include<stdio.h> #include<string.h> #include<math.h> using namespace std; long long int t,type,a,b,c; char ary[10000]; long long int length(char *arr){ return strlen(arr); } double length(long long int a,long long int b){ return sqrt(pow(a,2)+pow(b,2)); } double length(long long int a,long long int b,long long int c){ return sqrt(pow(a,2)+pow(b,2)+pow(c,2)); } int main(){ scanf("%lld",&t); while(t--){ scanf("%lld",&type); if(type==1){ scanf("%s",ary); printf("%lld\n",length(ary)); } else if(type==2){ scanf("%lld%lld",&a,&b); printf("%lf\n",length(a,b)); } else{ scanf("%lld%lld%lld",&a,&b,&c); printf("%lf\n",length(a,b,c)); } } }
Editor is loading...