Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
109860 | 胡海峰老师 | 统计硬币 | C++ | Accepted | 2 MS | 268 KB | 423 | 2025-02-13 09:44:48 |
#include <iostream> using namespace std; int main(){ int n,m,t; int a,b,c,tot; cin>>t; for(int i=1;i<=t;i++) { cin>>n>>m; tot = 0; for(a=0;a<=n;a++) for(b=0;b<=n;b++) { c = n -a-b; if(a*1+b*2+c*5 == m) { //cout<< a <<"-"<<b<<"-"<<c<<endl; tot++; } } cout<<tot<<endl; } return 0; } /* Input 2 3 5 4 8 Output 1 2 */