Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
137489 hjx2333 统计硬币 C++ Wrong Answer 4 MS 272 KB 766 2025-11-17 20:58:29

Tests(0/1):


Code:

#include <bits/stdc++.h> using namespace std; int main() { int c,d,f,i,j,k,n,m,s,t,sum,temp,a[3]={1,2,5}; cin>>t; while (t--) { cin>>n>>m; c=f=i=0; sum=0; while (f<=n*3-1) { d=s=0; while (d<n-c) { s=s+a[i]; if (s==m) sum++; d++; } while (d<n) { s=s+a[i+1]; if (s==m) sum++; d++; if (d==2) break; } while (d<n) { s=s+a[i+2]; if (s==m) sum++; d++; } c++; f++; if (c==n) c=0; if (f==n) { temp=a[0]; a[0]=a[1]; a[1]=temp; } else if (f==n*2) { temp=a[0]; a[0]=a[2]; a[2]=temp; } } cout<<sum<<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-----
6 8 1 1 5 3 1 1 3 1 1 83 501 3 6 2 3 11 16 0