全部评论 7

  • 这题得用double来定义变量N,否则可能会有问题。

    2026-03-28 来自 浙江

    1
  • 浮点数不能够用int

    2026-01-29 来自 内蒙古

    1
  • 《int》

    2026-01-19 来自 上海

    1
  • 正确代码

    #include<iostream>
    using namespace std;
    int main(){
        double a;
        cin>>a;
        if(a>3.1415926){
            cout<<"yes"<<endl;
        }
        else{
            cout<<"no"<<endl;
        }
        return 0;
    }
    

    问题所在
    你的是用的int类型,但如果样例输入的是浮点数类型,那么你的程序的n,可能会有问题

    2026-01-17 来自 上海

    1
  • 把int改为double

    2026-01-15 来自 广东

    1
  • 你已经用```cpp了,可以进行Tab
    可以像这样:

    #include <iostream>
    using namespace std;
    int main(){    
        int n;    
        cin>>n;
        if(n>3.1415926)    
            cout<<"yes";    
        else    
            cout<<"no";    
        return 0;
    }
    

    错误点:int会向下取整
    不过我已经知道你会了

    2天前 来自 广东

    0
  • #include<iostream>
    using namespace std;
    int main(){
    double n;
    cin>>n;
    if(n > 3.1415926){
    cout<<"yes";
    }
    else{
    cout<<"no";
    }
    return 0;
    }

    2026-07-19 来自 河南

    0

热门讨论