什么鬼!这叫入门题!

P2433 【深基1-2】小学数学 N 合一

W_churchill @ 2020-05-08 19:33:07

else if (T == 8) 
    {
        cout<<5*2*3.141593<<" ";             
        cout<<5*5*3.141593<<" ";
        cout<<1.0*double(4/3)*3.141593*125.0<<" ";
        return 0;
} 
else if (T == 13) 
{
        int sum=4*4*4*3.141593;
        sum+=10*10*10*3.141593;
        cout<<prime(sum)<<endl;
        return 0;
} 

为什么T8和T13一直过不了啊???
小学生的我太菜了


by Novice233 @ 2020-05-08 19:38:42

@Qinclude 还有 请检查一下你的prime函数


by W_churchill @ 2020-05-08 19:39:06

T13的函数为

int prime(int x)
{
    for(int i=1;i<=100;i++)
        if(i*i*i==x) return i;
}

by W_churchill @ 2020-05-08 19:39:51

为什么没人看T8


by tangrunxi @ 2020-05-08 19:40:13

@Qinclude 要换行输出而不是空格


by tangrunxi @ 2020-05-08 19:40:20

@Qinclude T8


by Novice233 @ 2020-05-08 19:40:53

@Qinclude T13的函数的int都换成double


by W_churchill @ 2020-05-08 19:41:37

@tangrunxi 加空格我是为了看哪一点错了,提交的时候没加


by W_churchill @ 2020-05-08 19:42:50

@JR_Stark 改了之后输出nan了??!!


by 江户川·萝卜 @ 2020-05-08 19:43:51

double(4/3)应该只是把4/3(整除)的结果强制转换为double,建议4.0/3


by kjy_ttcl @ 2020-05-08 19:44:46

@Qinclude 8:每行一个数字


上一页 | 下一页