답안 #551381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
551381 2022-04-20T14:29:00 Z Olympia 홀-짝 수열 (IZhO11_oddeven) C++17
0 / 100
1 ms 212 KB
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <map>
#include <complex>
#include <cmath>
#include <set>
#include <queue>
using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int64_t n; cin >> n;
    int64_t sq = sqrt(n * 2);
    if (n == 1) {
        cout << 1 << '\n';
        return 0;
    }
    if (n == 4) {
        cout << "5\n";
        return 0;
    }
    cout << sq * sq + 2 *(n - (sq + 1) * sq/2) << '\n';
}

Compilation message

oddeven.cpp:14: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   14 | #pragma GCC optimization ("O3")
      | 
oddeven.cpp:15: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   15 | #pragma GCC optimization ("unroll-loops")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -