/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 312.0 KiB
#3 Accepted 0ms 584.0 KiB

Code

#include <stdio.h>

int main() {
    int T;  // Number of test cases
    scanf("%d", &T);  // Input the number of test cases
    
    // Iterate through each test case
    for (int t = 0; t < T; t++) {
        int N;  // The number for the current test case
        scanf("%d", &N);  // Input the number N
        
        // Calculate the number of odd numbers between 1 and N
        int odd_count = (N + 1) / 2;  // Odd numbers are at positions 1, 3, 5, 7, ..., up to N
        
        // Output the result
        printf("%d\n", odd_count);
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1041 Odd number
Language
C99 (GCC 13.2.0)
Submit At
2025-01-31 13:34:09
Judged At
2025-01-31 13:34:09
Judged By
Score
100
Total Time
1ms
Peak Memory
584.0 KiB