我的这个例子里缺了什么?

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

chiyuye @ 2021-08-24 10:51:14

#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main() {
    int T;
    cin >> T;
    if (T == 1) {
        cout << "I love Luogu!";
    } else if (T == 2) {
        cout << 2 + 4 << " " << 10 - 2 - 4;
    } else if (T == 3) {
        cout<<"3"<<" "<<"12"<<" "<<"2";

    } else if (T == 4) {
        cout<<fixed<<setprecision(3)<<1.0*500/3;

    } else if (T == 5) {
        cout<<(220+260)/(20+12);
    } else if (T == 6) {
        cout<<sprt(6*6+9*9)
    } else if (T == 7) {
        cout<<"110"<<" "<<"90"<<" "<<"0";
    } else if (T == 8) {
        const double pi=3.141593;
        cout<<pi*10<<endl<<pi*25<<endl<<4/3*pi*125;
    } else if (T == 9) {
        cout<<"22";
    } else if (T == 10) {
        cout<<"9";
    } else if (T == 11) {
        cout<<1.0*100/3;
    } else if (T == 12) {
        cout<<"13"<<endl<<"R";
    } else if (T == 13) {
        const double pi=3.141593;
        cout<<(int)(pow(4/3*pi*(4*4*4+10*10*10),1.0*1/3));
    } else if (T == 14) {
        cout<<"50";
    }
    return 0;
}

by Textbook_blasphemy @ 2021-08-24 10:52:19

@chiyuye

if (T == 6) {
        cout<<sprt(6*6+9*9)

sprt?


by Textbook_blasphemy @ 2021-08-24 10:52:58

@chiyuye 3,7,8,13WA


by chiyuye @ 2021-08-24 10:54:54

@陶(戴)佳伟求大佬指教


by chiyuye @ 2021-08-24 10:57:50

sprt 是次方的运算符@陶(戴)佳伟


by QiaoHongYi @ 2021-08-24 10:59:26

@chiyuye sqrt是根号运算吧。。。pow才是次方运算


by Textbook_blasphemy @ 2021-08-24 10:59:53

@chiyuye 不是sqrt


by chiyuye @ 2021-08-24 11:04:41

哪里错了,还是不行(扎心➳♥゛)


by chiyuye @ 2021-08-24 11:05:43

谢谢纠错 @是QHY吖


by chiyuye @ 2021-08-24 11:07:40

还是wa


by Lucashuang @ 2021-09-26 21:17:24

#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;
int main(){
    int n;
    double pi = 3.141593;
    cin >> n;
    if(n == 1){
        cout << "I love Luogu!" << endl;
    } else if(n == 2){
        cout << "6 4" << endl;
    } else if(n == 3){
        cout << "3" << endl << "12" << endl << "2" << endl;
    } else if(n == 4){
        printf("%0.3lf" , 500.0 / 3);
    } else if(n == 5){
        cout << "15" << endl;
    } else if(n == 6){
        cout << sqrt(117) << endl;
    } else if(n == 7){
        cout << "110" << endl << "90" << endl << "0" << endl;
    } else if(n == 8){
        cout << 2 * pi * 5 << endl << pi * (5 * 5) << endl << (4.0 / 3) * pi * (5 * 5 * 5) << endl;
    } else if(n == 9){
        cout << "22" << endl;
    } else if(n == 10){
        cout << "9" << endl;
    } else if(n == 11){
        cout << 100.0 / (8 - 5) << endl;
    } else if(n == 12){
        cout << "13" << endl << "R" << endl;
    } else if(n == 13){
        cout << round(pow((4.0 / 3) * pi * (4 * 4 * 4 + 10 * 10 * 10) , 1.0 / 3)) << endl;
    } else if(n == 14){
        cout << "50" << endl;
    }
}

| 下一页