結果

問題 No.411 昇順昇順ソート
ユーザー kapokapo
提出日時 2016-08-12 23:35:51
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,036 bytes
コンパイル時間 605 ms
コンパイル使用メモリ 79,080 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 15:55:09
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int main()
{
	int N, K;
	cin >> N >> K;

	if (N==2 && K==1) {
		cout << 0 << endl;
		return 0;
	}

	ll ans = 1;
	if (K == 1) {
		rep(i,0,N-1) ans <<= 1;
		ans -= N;
	}
	else {
		rep(i,0,N-K) ans <<= 1;
	}
	cout << ans << endl;
	return 0;
}
0