/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Wrong Answer 2ms 540.0 KiB
#3 Wrong Answer 17ms 548.0 KiB

Code

#include <iostream>
using namespace std;
int main() {
    
    // SAYED AL MAMUN_LU

    int t;
    cin >> t;

    while (t--) {
        long long int n, result;
        cin >> n;

        if (n == 1) {
            result = 0;
        } 
        else if(n == 2){
            result = 1;
        }
        else {
            int sum = 0;
            for (int i = n - 1; i >= 1; i--) {
                sum += i;
            }

            int team = n / 2;
            if (team > 1) {
                for (int i = team - 1; i >= 1; i--) {
                    sum += i;
                }
            } 
            else {
                sum += 1;
            }

            result = sum;
        }

        cout << result << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1026 LUFA cup 2024
Contest
Brain booster #2
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-06 16:50:42
Judged At
2024-11-11 03:41:11
Judged By
Score
10
Total Time
17ms
Peak Memory
548.0 KiB