Run ID:109860
提交时间: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 */