結果

問題 No.411 昇順昇順ソート
ユーザー Seki-t
提出日時 2016-08-12 23:15:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 65,852 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 15:46:46
合計ジャッジ時間 1,463 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 26 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int arr[100];
int N,K;


int Zyun(int n,int r){
	return r!=0 ? n*Zyun(n-1,r-1) : 1;
}
int fact(int n){
	return n!=0 ? n*fact(n-1) : 1;
}


int main(){
	int sum = 1;
	cin>>N>>K;
	
	if(N==1){
		cout<<"0"<<endl;
		return 0;
	}
	
	int p = N-K;	//p = 2
	for(int i = 1;i<=p;i++){
		sum += Zyun(p,i) / fact(i);
	
		// fact(2,0)/fact(0,0)
	}
	cout<<sum<<endl;
		return 0;
}

0