SPOJ MARBLES

来源:互联网 发布:scratch编程怎么下载 编辑:程序博客网 时间:2024/06/05 21:01
// http://www.spoj.com/problems/MARBLES/#include <iostream>using namespace std;// 假设30个位置void f() {int n, k;cin >> n >> k;long double result;n--;k--;result = 1.0;for(double i=0.0; i<k; i+=1.0) {result*=(n-i)/(k-i);}cout << (long long int)(result + (long double)0.5) << endl;}int main() {int t;cin >> t;while (t--) {f();}}

0 0
原创粉丝点击