众所周知,在每一个彗星后都有一只UFO。这些UFO时常来收集地球上的忠诚支持者。不幸的是,他们的飞碟每次出行都只能带上一组支持者。因此,他们要用一种聪明的方案让这些小组提前知道谁会被彗星带走。他们为

#include <iostream>
#include <cstring>
using namespace std;
int i;
int main()
{
    char a[20],b[20];
    int c=1,d=1;
    int s1,s2;
    cin >> a >> b;
    s1 = strlen(a); //测出它的串长
    s2 = strlen(b);
    for(i=0;i<s1;i++) c=c*((int)a[i]-64);//这里运用了ascall码
    for(i=0;i<s2;i++) d=d*((int)b[i]-64);//这里运用了ascall码
    if(c%47==d%47)
        cout<<"GO";
    else
        cout << "STAY";
    return 0;
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,这里是一份用MATLAB语言编写的绘制哈雷彗星运行轨迹的代码,适用于R2021a版本的MATLAB: ``` % 定义哈雷彗星的轨道参数 a = 17.834e10; % 半长轴(m) e = 0.96714; % 离心率 i = 162.262; % 轨道倾角(°) Omega = 58.42; % 升交点赤经(°) omega = 111.33; % 近地点幅角(°) M0 = 38.38; % 平均近点角(°) T = 76.1*365*24*3600; % 周期(s) % 定义计算时间范围 t_start = 0; t_end = 2*T; dt = 3600; % 计算哈雷彗星在每个时刻的位置 t = t_start:dt:t_end; n = 2*pi/T; M = M0 + n*t; E = M; for i = 1:length(t) while abs(E(i) - e*sin(E(i)) - M(i)) > 1e-8 E(i) = E(i) - (E(i) - e*sin(E(i)) - M(i))/(1 - e*cos(E(i))); end end nu = 2*atan(sqrt((1+e)/(1-e)).*tan(E/2)); r = a*(1-e^2)./(1+e*cos(nu)); x = r.*cos(nu); y = r.*sin(nu); z = zeros(size(x)); [xx,yy,zz] = sph2cart(deg2rad(Omega),deg2rad(i),deg2rad(omega)); R = [cosd(Omega)*cosd(omega)-sind(Omega)*cosd(i)*sind(omega) -cosd(Omega)*sind(omega)-sind(Omega)*cosd(i)*cosd(omega) sind(Omega)*sind(i); ... sind(Omega)*cosd(omega)+cosd(Omega)*cosd(i)*sind(omega) -sind(Omega)*sind(omega)+cosd(Omega)*cosd(i)*cosd(omega) -cosd(Omega)*sind(i); ... sind(i)*sind(omega) cosd(i)*sind(omega) cosd(i)*cosd(omega)]; pos = R*[x; y; z]; x = pos(1,:); y = pos(2,:); z = pos(3,:); % 绘制哈雷彗星运行轨迹 figure; plot3(x, y, z); title('Halley Comet Orbit'); xlabel('x (m)'); ylabel('y (m)'); zlabel('z (m)'); axis equal; ``` 此代码将计算哈雷彗星在给定时间范围内的位置,并绘制其三维运行轨迹。您可以在MATLAB中运行此代码,生成哈雷彗星运行轨迹的图形。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值