旷野大计算削弱版
必会公式:和差化积公式、积化和差公式。
定义域说明
在本题中,所有反三角函数都能满足其定义域,因为 a,b∈[0.09,0.1],不会超过反三角函数的定义域范围。
设 α=arcsina,β=arcsinb,于是 a=sinα,b=sinβ。
Task1:A+B Problem
由于我们只能用乘法和三角函数来计算 a+b,我们容易想到利用和差化积转换原式:
a+b=sinα+sinβ=2sin2α+βcos2α−β
由于我们不允许使用加法节点计算 α+β 和 α−β,我们应该进一步把它们用乘积的形式表示出来:
对于 α+β,我们注意到两角和余弦公式及其变形:
cos(α+β)=cosαcosβ−sinαsinβ=cosαcosβ(1−tanαtanβ)
两角和余弦公式变形证明
对于两角和余弦公式一般形式:
cos(α+β)=cosαcosβ−sinαsinβ对等号右边提取公因式得:
cos(α+β)=cosαcosβ(1−cosαcosβsinαsinβ)①由正切函数定义可得 tanα=cosαsinα,tanβ=cosβsinβ,代入①式中可得:
cos(α+β)=cosαcosβ(1−tanαtanβ)
对于形如 1−x 的代数式,我们可以用半角公式继续变形:
1−x=2sin2(2arccosx)②
再对 cos2α−β 用半角公式变形:
cos2α−β=cos2αcos2β(1+tan2αtan2β)
对于形如 1+x 的代数式,我们还可以用半角公式继续变形:
1+x=2cos2(2arccosx)③
1±x 三角变换公式证明
公式②证明:
令 θ=arccosx,θ∈[0,π],由反余弦函数定义可得 cosθ=cos(arccosx)=x。
由半角正弦公式可得:
sin22θ=21−cosθ将 θ=arccosx 代入可得:
sin2(2arccosx)=21−x整理可得:
1−x=2sin2(2arccosx)公式③证明:
依旧令 θ=arccosx,同理可得 cosθ=x。
由半角余弦公式可得:
cos22θ=21+cosθ将 θ=arccosx 代入可得:
cos2(2arccosx)=21+x整理可得:
1+x=2cos2(2arccosx)
计算过程没有用到加法节点。
Task2:A*B Problem
由于我们只能用加法和三角函数来计算 ab,我们容易想到利用积化和差转换原式:
cos(α−β)−cos(α+β)=2sinαsinβ=2ab
其中减法和除以 2 操作需要额外处理一下:
取相反数可用公式 −x=arcsin(sin(x+π));
计算 2x 可用倒数实现:
2x=cot(arctanx2),x1=cot(arctanx).
x1 和 2x 三角变换公式证明
证明 x1=cot(arctanx):
令 θ=arctanx,由反正切定义可得 tanθ=x。
由余切定义得:
cotθ=tanθ1将 θ=arctanx 回代可得:
x1=cot(arctanx)证明 2x=cot(arctanx2):
令 t=x2,代入上式可得:
t1=cot(arctant)整理可得:
2x=cot(arctanx2)这两个公式成立需要满足 x=0。
计算过程没有用到乘法节点。
AC Code
C++#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define int long long
#define ull unsigned long long
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t;
cin>>t;
if(t==1){
cout<<"41\n";
cout<<"3 1 asin\n";
cout<<"3 2 asin\n";
cout<<"3 3 cos\n";
cout<<"3 4 cos\n";
cout<<"3 3 sec\n";
cout<<"3 4 sec\n";
cout<<"2 1 2\n";
cout<<"2 9 7\n";
cout<<"2 10 8\n";
cout<<"3 11 acos\n";
cout<<"0 0.5\n";
cout<<"2 12 13\n";
cout<<"3 14 sin\n";
cout<<"2 15 15\n";
cout<<"0 2\n";
cout<<"2 16 17\n";
cout<<"2 5 6\n";
cout<<"2 19 18\n";
cout<<"3 20 acos\n";
cout<<"2 21 13\n";
cout<<"3 22 sin\n";
cout<<"2 3 13\n";
cout<<"2 4 13\n";
cout<<"3 24 cos\n";
cout<<"3 24 sin\n";
cout<<"3 24 sec\n";
cout<<"2 27 28\n";
cout<<"3 25 cos\n";
cout<<"3 25 sin\n";
cout<<"3 25 sec\n";
cout<<"2 31 32\n";
cout<<"2 29 33\n";
cout<<"3 34 acos\n";
cout<<"2 35 13\n";
cout<<"3 36 cos\n";
cout<<"2 37 37\n";
cout<<"2 38 17\n";
cout<<"2 26 30\n";
cout<<"2 40 39\n";
cout<<"2 23 41\n";
cout<<"2 42 17\n";
}
else{
cout<<"19\n";
cout<<"3 1 asin\n";
cout<<"3 2 asin\n";
cout<<"0 3.14159265358979\n";
cout<<"1 4 5\n";
cout<<"3 6 sin\n";
cout<<"3 7 asin\n";
cout<<"1 3 8\n";
cout<<"3 9 cos\n";
cout<<"1 3 4\n";
cout<<"3 11 cos\n";
cout<<"1 12 5\n";
cout<<"3 13 sin\n";
cout<<"3 14 asin\n";
cout<<"1 10 15\n";
cout<<"3 16 atan\n";
cout<<"3 17 cot\n";
cout<<"1 18 18\n";
cout<<"3 19 atan\n";
cout<<"3 20 cot\n";
}
return 0;
}