結果
問題 | No.411 昇順昇順ソート |
ユーザー |
![]() |
提出日時 | 2018-04-13 00:13:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 645 bytes |
コンパイル時間 | 720 ms |
コンパイル使用メモリ | 83,056 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-26 21:36:20 |
合計ジャッジ時間 | 1,694 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#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 func( int a ) { if ( a == 1 ) { return 0; } int ret = 0; for ( int i = 2; i <= a; i++ ) { ret += 1<<(a-i); } ret += func( a-1 ); return ret; } int main() { int N,K; cin >> N >> K; if ( K == 1 ) { cout << func(N-1) << endl; } else { cout << (1<<(N-K)) << endl; } return 0; }