Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
106862 | 胡海峰老师 | 统计硬币 | C++ | Accepted | 2 MS | 268 KB | 397 | 2025-01-16 19:58:39 |
#include <iostream> using namespace std; int main() { int t1,cnt,n,m; cin>>t1; for(int i=1;i<=t1;i++) { cnt =0; cin>>n>>m; //n硬币数量,m是面值 for(int j=0;j<=n;j++) for(int k=0;k<=n;k++) { int t = n-j-k; if(j*1+k*2 + t*5==m ) cnt++; } cout<<cnt<<endl; } return 0; } /* Input 2 3 5 4 8 Output 1 2 */