F3
#include<bits/stdc++.h>
using namespace std;
double p_convert_d(int n)
{
// 1 == > 60
return n / 60;
}
int main()
{
const double pi = 3.14;
int n;
cin>>n;
double k = p_convert_d(n);
double s;
for(int i = 1 ; i <= 1000000000 ;i++)
{
s = k - k*i;
if(s <= 360)
break;
}
if(k > 0 && k < 90)
cout<<"I";
if(k > 90 && k < 180)
cout<<"II";
if(k > 180 && k < 270)
cout<<"III";
if(k > 270 && k < 360)
cout<<"IV";
cout<<endl;
cout<<"cos(x) = "<<cos((k*pi)/180);
return 0;
}
F1
#include <bits/stdc++.h>
using namespace std;
void daonguoc(int n)
{
int t;
while(n != 0)
{
t = n % 10;
cout<<t;
n = n / 10;
}
}
int main()
{
int n, count = 0 , k , sum = 0, t;
cin>>n;
int z = n;
while(n != 0)
{
t = n % 10;
count++;
if(count == 1)
k = t;
sum = sum + t;
n = n / 10;
}
int j = t;
cout<<z<<" la so co "<<count<<" chu so"<<endl;
cout<<"Chu so cuoi cung la "<<k<<endl;
cout<<"Chu so dau tien la "<<j<<endl;
cout<<"Tong cac chu so "<<sum<<endl;
cout<<"So dao nguoc la: ";
daonguoc(z);
return 0;
}
F2
#include <bits/stdc++.h>
using namespace std;
double range(int x1 , int y1 , int x2 , int y2)
{
return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}
double acreage(int a , int b , int c)
{
if(a+b > c && a + c > b && b + c > a)
return sqrt(((a+b+c)/2)*(((a+b+c)/2)-a)*(((a+b+c)/2)-b)*(((a+b+c)/2)-c));
}
double check_the_coefficient(int a1 , int c1 , int a2 , int c2 , int xm , int ym)
{
double d = a1*1 - a2*1;
double dx = c1*1 - c2*1;
double dy = a1*c2 - a2*c1;
double a = dx/d;
double b = dy/d;
//y = ax + b
double y = a*xm + b - ym;
return y;
}
int main()
{
int x[4],y[4];
for(int i = 0 ; i < 4 ; i++)
cin>>x[i]>>y[i];
int xa = x[0] , ya = y[0];
int xb = x[1] , yb = y[1];
int xc = x[2] , yc = y[2];
int xm = x[3] , ym = y[3];
double AB = range(x[0] , y[0] , x[1] , y[1]);
double AC = range(x[0] , y[0] , x[2] , y[2]);
double BC = range(x[1] , y[1] , x[2] , y[2]);
double AM = range(x[0] , y[0] , x[3] , y[3]);
double BM = range(x[1] , y[1] , x[3] , y[3]);
double CM = range(x[2] , y[2] , x[3] , y[3]);
double S_abc = acreage(AB , AC , BC);
double S_abm = acreage(AB , BM , AM);
double S_acm = acreage(AC , CM , AM);
double S_bcm = acreage(BC , CM , BM);
double Check_sum_S = S_abm + S_acm + S_bcm;
if(Check_sum_S == S_abc)
cout<<"M in the side of the triangle ABC";
int k1 = check_the_coefficient(x[0],y[0],x[1],y[1],x[3],y[3]);
int k2 = check_the_coefficient(x[0],y[0],x[2],y[2],x[3],y[3]);
int k3 = check_the_coefficient(x[2],y[2],x[1],y[1],x[3],y[3]);
if(k1 == 0 || k2 == 0 || k3 == 0)
cout<<"M is on the side of the triangle ABC";
return 0;
}