标签:algorithm str main bottom acm color 接下来 names style
又是一个水题?? 不过还是弄是很久... 在蒟蒻的路上越走越远 , 好了讲题
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 13433 Accepted Submission(s): 4641
#include<iostream> #include<algorithm> using namespace std; long long g(int n, int m){ if(n < m) return 0; else if(m == 0 || n == m) return 1; else{ m = max(m, n-m); long long ans = 1; for(int i=1; i<=m; i++) ans = ans*(n-i+1)/i; return ans; } } int main(){ int T; cin >> T; while(T--){ int m, n; cin >> m >> n; cout << g(m, n) << endl; } return 0; }
标签:algorithm str main bottom acm color 接下来 names style
原文地址:http://www.cnblogs.com/ledoc/p/6208914.html