P1888 trigonometric function

P1888 trigonometric function

Submit 103.51k

Pass 48.29k

Time limit 1.00s

Memory limit 125.00MB

Submit the answer to the list copy the question

Question making plan (front page)

Personal questionnaire

Team checklist

preservation

Select team

preservation

Title provider Nekonata

difficulty Getting started

Historical score 100

Submit recordsCheck the solution

label

View algorithm label

Enter the discussion board

Related discussion

View discussion

Recommended topics

View recommendations

Luogu recommended closing

Copy Markdown deployment

Title Description

Enter a group of Pythagorean numbers a,b,c (a\neq b\neq c) a,b,c (a  =b  =c), and output the sine value of its small acute angle in fractional format. (points are required.)

Input format

One line, including three positive integers, namely, the number of stocks a,b,ca,b,c (no size order).

Output format

A line containing a fraction, the sine of a small acute angle

Sample input and output

Enter \1 copy

3 5 4

Output \1 copy

3/5

Description / tips

Data guarantee: a,b,ca,b,c are positive integers and \in [1,10^9] ∈ [1109].

[AC code]

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
inline int fread()
{
	char ch=getchar();
	int n=0,m=1;
	while(ch<'0' or ch>'9')
	{
		if(ch=='-')m=-1;
		ch=getchar();
	}
	while(ch>='0' and ch<='9')n=(n<<3)+(n<<1)+ch-48,ch=getchar();
	return n*m;
}
int a[N];
signed main(int argc,char **argv)
{
	for(int i=1;i<4;i++)a[i]=fread();
	sort(a+1,a+4);
	for(int i=a[1];i>0;i--)
		if(a[1]%i==0 and a[3]%i==0)
		{
			a[1]/=i,a[3]/=i;
			break;
		}
	cout<<a[1]<<"/"<<a[3];
	return 0;
}
Pay attention

Submit 103.51k

Pass 48.29k

Time limit 1.00s

Memory limit 125.00MB

Submit the answer to the list copy the question

Question making plan (front page)

Personal questionnaire

Team checklist

preservation

Select team

preservation

Title provider Nekonata

difficulty Getting started

Historical score 100

Submit recordsCheck the solution

label

View algorithm label

Enter the discussion board

Related discussion

View discussion

Recommended topics

View recommendations

Luogu recommended closing

Copy Markdown deployment

Title Description

Enter a group of Pythagorean numbers a,b,c (a\neq b\neq c) a,b,c (a  =b  =c), and output the sine value of its small acute angle in fractional format. (points are required.)

Input format

One line, including three positive integers, namely, the number of stocks a,b,ca,b,c (no size order).

Output format

A line containing a fraction, the sine of a small acute angle

Sample input and output

Enter \1 copy

3 5 4

Output \1 copy

3/5

Description / tips

Data guarantee: a,b,ca,b,c are positive integers and \in [1,10^9] ∈ [1109].

[AC code]

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
inline int fread()
{
	char ch=getchar();
	int n=0,m=1;
	while(ch<'0' or ch>'9')
	{
		if(ch=='-')m=-1;
		ch=getchar();
	}
	while(ch>='0' and ch<='9')n=(n<<3)+(n<<1)+ch-48,ch=getchar();
	return n*m;
}
int a[N];
signed main(int argc,char **argv)
{
	for(int i=1;i<4;i++)a[i]=fread();
	sort(a+1,a+4);
	for(int i=a[1];i>0;i--)
		if(a[1]%i==0 and a[3]%i==0)
		{
			a[1]/=i,a[3]/=i;
			break;
		}
	cout<<a[1]<<"/"<<a[3];
	return 0;
}
Pay attention

Submit 103.51k

Pass 48.29k

Time limit 1.00s

Memory limit 125.00MB

Submit the answer to the list copy the question

Question making plan (front page)

Personal questionnaire

Team checklist

preservation

Select team

preservation

Title provider Nekonata

difficulty Getting started

Historical score 100

Submit recordsCheck the solution

label

View algorithm label

Enter the discussion board

Related discussion

View discussion

Recommended topics

View recommendations

Luogu recommended closing

Copy Markdown deployment

Title Description

Enter a group of Pythagorean numbers a,b,c (a\neq b\neq c) a,b,c (a  =b  =c), and output the sine value of its small acute angle in fractional format. (points are required.)

Input format

One line, including three positive integers, namely, the number of stocks a,b,ca,b,c (no size order).

Output format

A line containing a fraction, the sine of a small acute angle

Sample input and output

Enter \1 copy

3 5 4

Output \1 copy

3/5

Description / tips

Data guarantee: a,b,ca,b,c are positive integers and \in [1,10^9] ∈ [1109].

[AC code]

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
inline int fread()
{
	char ch=getchar();
	int n=0,m=1;
	while(ch<'0' or ch>'9')
	{
		if(ch=='-')m=-1;
		ch=getchar();
	}
	while(ch>='0' and ch<='9')n=(n<<3)+(n<<1)+ch-48,ch=getchar();
	return n*m;
}
int a[N];
signed main(int argc,char **argv)
{
	for(int i=1;i<4;i++)a[i]=fread();
	sort(a+1,a+4);
	for(int i=a[1];i>0;i--)
		if(a[1]%i==0 and a[3]%i==0)
		{
			a[1]/=i,a[3]/=i;
			break;
		}
	cout<<a[1]<<"/"<<a[3];
	return 0;
}
Pay attention

Tags: C++ Network Protocol p2p programming language

Posted by Weedpacket on Wed, 01 Jun 2022 09:54:19 +0530