Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
153385 陈棋 统计硬币 C++ Wrong Answer 2 MS 272 KB 529 2026-05-16 16:22:54

Tests(0/1):


Code:

#include<iostream> using namespace std; int main(){ // int n; // while(cin>>n){ // int count=0; // int num=0; // while(true){ // num++; // if(num%3==0||num%5==0){ // count++; // if(count==n){ // break; // } // } // } // cout<<num<<endl; // } int T; cin>>T; while(T--){ int n,m; cin>>n>>m; int ans=0; for(int z=0;z<=n;z++){ for(int y=0;y<=n-z;y++){ int x=n-y-z; if(x>0&&x+2*y+5*z==m){ ans++; } } } cout<<ans<<endl; } return 0; }


Run Info:

------Input------
20 5 10 8 20 3 6 2 4 10 26 11 27 1 1 1 2 2 2 1 5 5 25 100 250 1000 3000 26 120 9 30 12 27 7 25 27 54 32 100 4 13
------Answer-----
2 2 1 1 3 3 1 1 1 1 1 21 167 1 2 3 1 7 6 1
------Your output-----
1 2 0 0 2 3 1 0 1 0 0 21 167 1 1 2 1 6 5 1