#34060: 這是錯在哪裡 一直tle


thomas930512 (s1113314)

學校 : 元智大學
編號 : 224133
來源 : [140.138.241.155]
最後登入時間 :
2023-03-01 21:02:23
a148. You Cannot Pass?! | From: [150.117.137.100] | 發表日期 : 2023-02-26 17:51

#include<iostream>
using namespace std;
 int main() {
    int n;
    cin >> n;
    double total = 0.0;
    for(int i = n;i>0;i--)
    {
        int grade;
        cin >> grade;
        total += grade;
    }
    if (total / n > 59    )
    {
        cout << "no" <<endl;
    }
    else
    {
        cout << "yes" << endl;
    }
    return main();
}

 
#34064: Re: 這是錯在哪裡 一直tle


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [101.136.203.77]
最後登入時間 :
2024-04-07 15:34:14
a148. You Cannot Pass?! | From: [106.64.128.25] | 發表日期 : 2023-02-26 18:31

#include
using namespace std;
 int main() {
    int n;
    cin >> n;
    double total = 0.0;
    for(int i = n;i>0;i--)
    {
        int grade;
        cin >> grade;
        total += grade;
    }
    if (total / n > 59    )
    {
        cout << "no" <    }
    else
    {
        cout << "yes" << endl;
    }
    return main();
}


讀到EOF要中止程式

 
ZeroJudge Forum