結果

問題 No.566 だいたい完全二分木
ユーザー tetsuzuki1115
提出日時 2017-09-28 08:14:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 803 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 84,912 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-15 18:12:35
合計ジャッジ時間 2,399 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    string ans = "";
    int K;
    cin >> K;
    
    int N = pow(2,K)-1;
    
    for ( int i = N/2; i >= 1; i -= 2 ) {
        ans += to_string(i) + " ";
    }
    for ( int i = N/2+2; i <= N; i += 2 ) {
        ans += to_string(i) + " ";
    }
    for ( int i = N/2-1; i >= 1; i -= 2 ) {
        ans += to_string(i) + " ";
    }
    for ( int i = N/2+1; i <= N; i += 2 ) {
        ans += to_string(i) + " ";
    }
    
    cout << ans.erase( ans.length()-1, 1 ) << endl;
    
    return 0;
}
0